Skip to content

Conversation

@96hoshi
Copy link

@96hoshi 96hoshi commented Oct 28, 2025

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.

Comment on lines 19 to 52
@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,
}

Copy link
Member

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

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants