def METHOD_NAME(
    small_scenario: Scenario,
    fast_rolling_stock: int,
    west_to_south_east_path: Path,
    service_url: str,
    timetable_id: Optional[int],
    status_code: int,
    expected_error: Mapping[str, Any],
):
    timetable_id = timetable_id or small_scenario.timetable
    response = requests.get(f"{service_url}timetable/{timetable_id}/")
    assert response.status_code == status_code
    if status_code == 404:
        assert expected_error == response.json()
        return
    timetable = _TimetableResponse(**response.json())
    assert timetable.name == "timetable"
    assert len(timetable.train_schedule_summaries) == 0
    # add simulation
    simulation_response = requests.post(
        f"{API_URL}train_schedule/standalone_simulation/",
        json=_two_train_simulation_payload(west_to_south_east_path.id, small_scenario.timetable, fast_rolling_stock),
    )
    assert simulation_response.status_code == 201
    simulation = _SimulationResponse(**simulation_response.json())
    assert len(simulation.ids) == 2
    response = requests.get(f"{service_url}timetable/{timetable_id}/")
    timetable = _TimetableResponse(**response.json())
    assert timetable.id == small_scenario.timetable
    assert timetable.name == "timetable"
    assert len(timetable.train_schedule_summaries) == 2
    expected_schedules = [
        _TrainScheduleSummary(
            id=simulation.ids[0],
            train_name="West to South East 1",
            departure_time=3600,
            arrival_time=4384.388065381583,
            path_id=west_to_south_east_path.id,
            timetable_id=small_scenario.timetable,
            rolling_stock_id=fast_rolling_stock,
            initial_speed=0,
            labels=["new train", "west", "south east"],
            allowances=[],
            speed_limit_tags=None,
            scheduled_points=[],
            comfort="STANDARD",
            options=None,
            power_restriction_ranges=None,
            mechanical_energy_consumed={"base": 6041639227.0, "eco": None},
            stops_count=1,
            path_length=45549.566000000006,
            invalid_reasons=[],
        ),
        _TrainScheduleSummary(
            id=simulation.ids[1],
            train_name="West to South East 3",
            departure_time=5100,
            arrival_time=5884.388065381583,
            path_id=west_to_south_east_path.id,
            timetable_id=small_scenario.timetable,
            rolling_stock_id=fast_rolling_stock,
            initial_speed=0,
            labels=["new train", "west", "south east"],
            allowances=[],
            speed_limit_tags=None,
            scheduled_points=[],
            comfort="STANDARD",
            options=None,
            power_restriction_ranges=None,
            mechanical_energy_consumed={"base": 6041639227.0, "eco": None},
            stops_count=1,
            path_length=45549.566000000006,
            invalid_reasons=[],
        ),
    ]
    assert expected_schedules == [
        _TrainScheduleSummary(**train_schedule) for train_schedule in timetable.train_schedule_summaries
    ]