@@ -23,13 +23,7 @@ def test_search_feeds_all_feeds(client: TestClient, search_query: str):
2323 """
2424 Retrieve all feeds with a search query using provider or feed name.
2525 """
26- params = [
27- ("limit" , 100 ),
28- ("offset" , 0 ),
29- ("feed_id" , "" ),
30- ("data_type" , "" ),
31- ("search_query" , search_query ),
32- ]
26+ params = [("limit" , 100 ), ("offset" , 0 ), ("feed_id" , "" ), ("data_type" , "" ), ("search_query" , search_query )]
3327 headers = {
3428 "Authentication" : "special-key" ,
3529 }
@@ -67,13 +61,7 @@ def test_search_feeds_all_feeds_with_limit(client: TestClient, search_query: str
6761 """
6862 Retrieve 2 feeds using limit with a search query using provider or feed name.
6963 """
70- params = [
71- ("limit" , 100 ),
72- ("offset" , 0 ),
73- ("feed_id" , "" ),
74- ("data_type" , "" ),
75- ("search_query" , search_query ),
76- ]
64+ params = [("limit" , 2 ), ("offset" , 0 ), ("feed_id" , "" ), ("data_type" , "" ), ("search_query" , search_query )]
7765 headers = {
7866 "Authentication" : "special-key" ,
7967 }
@@ -441,14 +429,14 @@ def test_search_filter_by_official_status(client: TestClient, values: dict):
441429@pytest .mark .parametrize (
442430 "values" ,
443431 [
444- {"features" : "Text-To-Speech " , "expected_count" : 3 },
445- {"features" : "Fare Products " , "expected_count" : 2 },
446- {"features" : "Levels " , "expected_count" : 1 },
432+ {"features" : "" , "expected_count" : 16 },
433+ {"features" : "Bike Allowed " , "expected_count" : 2 },
434+ {"features" : "Stops Wheelchair Accessibility " , "expected_count" : 0 },
447435 ],
448436 ids = [
449- "Accessibility " ,
450- "Fares " ,
451- "Pathways " ,
437+ "All " ,
438+ "Bike Allowed " ,
439+ "Stops Wheelchair Accessibility " ,
452440 ],
453441)
454442def test_search_filter_by_features (client : TestClient , values : dict ):
@@ -474,17 +462,18 @@ def test_search_filter_by_features(client: TestClient, values: dict):
474462 assert response .status_code == 200
475463
476464 # Parse the response body into a Python object
477- response_body = SearchFeeds200Response .parse_obj (response .json ())
465+ response_body = SearchFeeds200Response .model_validate (response .json ())
478466 expected_count = values ["expected_count" ]
479467 assert (
480468 response_body .total == expected_count
481469 ), f"There should be { expected_count } feeds with features={ values ['features' ]} "
482470
483471 # Verify all returned feeds have at least one of the requested features
484472 if values ["features" ] and expected_count > 0 :
485- requested_features = values ["features" ].split ("," )
473+ requested_features = set ( values ["features" ].split ("," ) )
486474 for result in response_body .results :
475+ features = result .latest_dataset .validation_report .features
487476 # Check that at least one of the feed's features is in the requested features
488- assert any (
489- feature in requested_features for feature in result . features
490- ), f"Feed { result . id } does not have any of the requested features: { requested_features } "
477+ assert requested_features . intersection ( features ), (
478+ f"Feed { result . id } with features { features } does not match " f"requested features { requested_features } "
479+ )
0 commit comments