Raise an error if Path._directions is not set ...

... instead of failing inside `json.loads()` on `None`
This commit is contained in:
Alexander Hess 2026-11-30 12:48:23 +01:00
commit 607055d55a
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -670,6 +670,13 @@ class TestSyncWithGoogleMaps:
class TestProperties:
"""Test properties in `Path`."""
def test_waypoints_no_directions(self, path):
"""Test `Path.waypoints` property."""
path._directions = None
with pytest.raises(RuntimeError, match="not set"):
int(path.waypoints)
def test_waypoints_structure(self, path):
"""Test `Path.waypoints` property."""
result = path.waypoints