-
Notifications
You must be signed in to change notification settings - Fork 55
feat(routing): added base ab_routing schemas and unit tests #3571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2.3.0
Are you sure you want to change the base?
Conversation
packages/python/goatlib/src/goatlib/routing/schemas/ab_routing.py
Outdated
Show resolved
Hide resolved
packages/python/goatlib/src/goatlib/routing/schemas/ab_routing.py
Outdated
Show resolved
Hide resolved
| @pytest.fixture | ||
| def valid_location_data() -> Dict[str, float]: | ||
| """Provides valid data for a Location model.""" | ||
| return {"lat": 48.8566, "long": 2.3522} | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def valid_leg_data(valid_location_data: Dict[str, float]) -> Dict[str, Any]: | ||
| """Provides a valid dictionary for creating an ABRouteLeg.""" | ||
| now = datetime.now(timezone.utc) | ||
| return { | ||
| "leg_id": "leg_123", | ||
| "mode": TransportMode.WALK, | ||
| "origin": valid_location_data, | ||
| "destination": {"lat": 48.8606, "long": 2.3376}, | ||
| "departure_time": now, | ||
| "arrival_time": now, | ||
| "duration": 300, | ||
| "distance": 500, | ||
| } | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def valid_route_data(valid_leg_data: Dict[str, Any]) -> Dict[str, Any]: | ||
| """Provides a valid dictionary for creating an ABRoute.""" | ||
| return { | ||
| "route_id": "route_abc", | ||
| "duration": 25, # Inherited from base Route | ||
| "distance": 1500, # Inherited from base Route | ||
| "time": datetime.now(timezone.utc), # Inherited from base Route | ||
| "legs": [valid_leg_data], | ||
| "optimization_score": 0.9, | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would better to test the response with some real data that motis returns. Maybe we can dump it in a json inside the data folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I am currently working on creating the json files
Added base ab_routing schemas and unit tests in the packages folder.
TODOs are related to default values and time fixtures that can be decided later.