27
27
],
28
28
}
29
29
30
- ITEM_EXAMPLE = {"collections" : "io-lulc" , "ids" : "60U-2020" }
30
+ ITEM_EXAMPLE : Dict [ str , Any ] = {"collections" : "io-lulc" , "ids" : "60U-2020" }
31
31
32
32
33
33
class TestItemPerformance :
@@ -49,7 +49,9 @@ def test_single_item(self, benchmark: BenchmarkFixture, single_href: str) -> Non
49
49
50
50
assert item .id == ITEM_EXAMPLE ["ids" ]
51
51
52
- def test_single_item_search (self , benchmark : BenchmarkFixture , single_href : str ) -> None :
52
+ def test_single_item_search (
53
+ self , benchmark : BenchmarkFixture , single_href : str
54
+ ) -> None :
53
55
search = ItemSearch (url = SEARCH_URL , ** ITEM_EXAMPLE )
54
56
55
57
item_collection = benchmark (search .get_all_items )
@@ -413,18 +415,18 @@ def test_sortby(self) -> None:
413
415
)
414
416
415
417
with pytest .raises (Exception ):
416
- ItemSearch (url = SEARCH_URL , sortby = 1 )
418
+ ItemSearch (url = SEARCH_URL , sortby = 1 ) # type: ignore[arg-type]
417
419
418
420
with pytest .raises (Exception ):
419
- ItemSearch (url = SEARCH_URL , sortby = [1 ])
421
+ ItemSearch (url = SEARCH_URL , sortby = [1 ]) # type: ignore[arg-type]
420
422
421
423
def test_fields (self ) -> None :
422
424
423
425
with pytest .raises (Exception ):
424
- ItemSearch (url = SEARCH_URL , fields = 1 )
426
+ ItemSearch (url = SEARCH_URL , fields = 1 ) # type: ignore[arg-type]
425
427
426
428
with pytest .raises (Exception ):
427
- ItemSearch (url = SEARCH_URL , fields = [1 ])
429
+ ItemSearch (url = SEARCH_URL , fields = [1 ]) # type: ignore[list-item]
428
430
429
431
search = ItemSearch (url = SEARCH_URL , fields = "id,collection,+foo,-bar" )
430
432
assert search .get_parameters ()["fields" ] == {
@@ -481,7 +483,7 @@ def test_method(self) -> None:
481
483
assert search .method == "GET"
482
484
483
485
def test_method_params (self ) -> None :
484
- params_in = {
486
+ params_in : Dict [ str , Any ] = {
485
487
"bbox" : (- 72 , 41 , - 71 , 42 ),
486
488
"ids" : (
487
489
"idone" ,
@@ -540,10 +542,12 @@ def test_datetime_results(self) -> None:
540
542
max_datetime = datetime (2019 , 1 , 1 , 0 , 0 , 10 , tzinfo = tzutc ())
541
543
search = ItemSearch (url = SEARCH_URL , datetime = (min_datetime , max_datetime ))
542
544
new_results = search .items ()
543
- assert all (
544
- min_datetime <= item .datetime <= (max_datetime + timedelta (seconds = 1 ))
545
- for item in new_results
546
- )
545
+
546
+ for item in new_results :
547
+ assert item .datetime is not None
548
+ assert (
549
+ min_datetime <= item .datetime <= (max_datetime + timedelta (seconds = 1 ))
550
+ )
547
551
548
552
@pytest .mark .vcr # type: ignore[misc]
549
553
def test_intersects_results (self ) -> None :
0 commit comments