Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmarks/time_filter_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

from benchmarks.common import generate_locations
from traveltimepy.requests.common import Property
from traveltimepy.requests.transportation import TransportationFast
from traveltimepy.async_client import AsyncClient
from traveltimepy.requests.time_filter_fast import (
TimeFilterFastArrivalSearches,
TimeFilterFastOneToMany,
)
from traveltimepy.requests.transportation import DrivingFerryFast, FastTrafficModel


async def generate_matrix(size: int):
Expand All @@ -22,7 +22,7 @@ async def generate_matrix(size: int):
arrival_location_ids=list(
filter(lambda cur_id: cur_id != location_id, location_ids)
),
transportation=TransportationFast.DRIVING,
transportation=DrivingFerryFast(traffic_model=FastTrafficModel.PEAK),
Comment thread
arnasbr marked this conversation as resolved.
travel_time=3600,
properties=[Property.TRAVEL_TIME],
)
Expand Down
4 changes: 2 additions & 2 deletions examples/time_filter_fast_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
TimeFilterFastArrivalSearches,
TimeFilterFastOneToMany,
)
from traveltimepy.requests.transportation import TransportationFast
from traveltimepy.requests.transportation import PublicTransportFast

import numpy as np

Expand Down Expand Up @@ -93,7 +93,7 @@ def create_fast_searches(locations, properties=None):
departure_location_id=origin.id,
arrival_location_ids=location_ids,
travel_time=7200,
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
properties=properties,
arrival_time_period=ArrivalTimePeriod.WEEKDAY_MORNING,
)
Expand Down
58 changes: 33 additions & 25 deletions tests/geohash_fast_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
GeoHashFastUnion,
GeoHashFastIntersection,
)
from traveltimepy.requests.transportation import TransportationFast, FastTrafficModel
from traveltimepy.requests.transportation import (
DrivingFerryFast,
FastTrafficModel,
PublicTransportFast,
)


@pytest.mark.asyncio
Expand All @@ -20,13 +24,13 @@ async def test_one_to_many(async_client: AsyncClient):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand All @@ -50,13 +54,13 @@ async def test_many_to_one(async_client: AsyncClient):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand All @@ -77,13 +81,13 @@ def test_one_to_many_sync(client: Client):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand All @@ -106,13 +110,13 @@ def test_many_to_one_sync(client: Client):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand All @@ -134,9 +138,10 @@ async def test_one_to_many_with_traffic_model(async_client: AsyncClient):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.DRIVING,
transportation=DrivingFerryFast(
traffic_model=FastTrafficModel.PEAK
),
Comment thread
arnasbr marked this conversation as resolved.
travel_time=900,
traffic_model=FastTrafficModel.PEAK,
),
],
many_to_one=[],
Expand All @@ -159,9 +164,10 @@ async def test_many_to_one_with_traffic_model(async_client: AsyncClient):
GeoHashFastSearch(
id="id",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.DRIVING_FERRY,
transportation=DrivingFerryFast(
traffic_model=FastTrafficModel.OFF_PEAK
),
Comment thread
arnasbr marked this conversation as resolved.
travel_time=900,
traffic_model=FastTrafficModel.OFF_PEAK,
),
],
),
Expand All @@ -181,9 +187,10 @@ def test_one_to_many_with_traffic_model_sync(client: Client):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.DRIVING,
transportation=DrivingFerryFast(
traffic_model=FastTrafficModel.PEAK
),
travel_time=900,
traffic_model=FastTrafficModel.PEAK,
),
],
many_to_one=[],
Expand All @@ -205,9 +212,10 @@ def test_many_to_one_with_traffic_model_sync(client: Client):
GeoHashFastSearch(
id="id",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.DRIVING_FERRY,
transportation=DrivingFerryFast(
traffic_model=FastTrafficModel.OFF_PEAK
),
travel_time=900,
traffic_model=FastTrafficModel.OFF_PEAK,
),
],
),
Expand All @@ -228,13 +236,13 @@ async def test_union_one_to_many(async_client: AsyncClient):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand All @@ -257,13 +265,13 @@ async def test_intersection_many_to_one(async_client: AsyncClient):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand All @@ -287,13 +295,13 @@ def test_union_one_to_many_sync(client: Client):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand All @@ -315,13 +323,13 @@ def test_intersection_many_to_one_sync(client: Client):
GeoHashFastSearch(
id="id",
coords=Coordinates(lat=51.507609, lng=-0.128315),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
GeoHashFastSearch(
id="id 2",
coords=GeohashCentroid(geohash_centroid="gcpvj3"),
transportation=TransportationFast.PUBLIC_TRANSPORT,
transportation=PublicTransportFast(),
travel_time=900,
),
],
Expand Down
Loading