22from typing import Final
33
44import pytest
5+ from faker import Faker
56from sqlalchemy .orm import Query
67
7- from shared .common .db_utils import apply_bounding_filtering
8- from shared .database .database import Database , generate_unique_id
9- from shared .database_gen .sqlacodegen_models import Feature , Gtfsdataset
108from feeds .impl .datasets_api_impl import DatasetsApiImpl
119from feeds .impl .feeds_api_impl import FeedsApiImpl
12- from faker import Faker
13-
10+ from shared .common .db_utils import apply_bounding_filtering
11+ from shared .database .database import Database , generate_unique_id
12+ from shared .database_gen .sqlacodegen_models import Feature , Gtfsfeed
1413from tests .test_utils .database import TEST_GTFS_FEED_STABLE_IDS , TEST_DATASET_STABLE_IDS
1514
1615VALIDATION_ERROR_NOTICES = 7
2322VALIDATION_ERROR_COUNT_PER_NOTICE = 2
2423
2524
26- BASE_QUERY = Query ([Gtfsdataset , Gtfsdataset .bounding_box .ST_AsGeoJSON ()]).filter (
27- Gtfsdataset .stable_id == TEST_DATASET_STABLE_IDS [0 ]
28- )
25+ BASE_QUERY = Query ([Gtfsfeed ])
2926fake = Faker ()
3027
3128
@@ -41,7 +38,8 @@ def test_bounding_box_dateset_exists(test_database):
4138def assert_bounding_box_found (latitudes , longitudes , method , expected_found , test_database ):
4239 with test_database .start_db_session () as session :
4340 query = apply_bounding_filtering (BASE_QUERY , latitudes , longitudes , method )
44- result = test_database .select (session , query = query )
41+ assert query is not None , "apply_bounding_filtering returned None"
42+ result = session .execute (query ).all ()
4543 assert (len (result ) > 0 ) is expected_found
4644
4745
0 commit comments