Skip to content

Commit 8a61146

Browse files
duckonthewebgadomski
authored andcommitted
Fix remaining type errors
1 parent 50cef48 commit 8a61146

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

Diff for: tests/test_client.py

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def test_no_stac_core_conformance(self) -> None:
7676
STAC API - Core spec."""
7777
client = Client.from_file(str(TEST_DATA / "planetary-computer-root.json"))
7878
assert client._stac_io is not None
79+
assert client._stac_io._conformance is not None
7980
client._stac_io._conformance = client._stac_io._conformance[1:]
8081

8182
with pytest.raises(NotImplementedError):
@@ -358,6 +359,7 @@ def test_search_conformance_error(self, api: Client) -> None:
358359
include information about the spec that was not conformed to."""
359360
# Set the conformance to only STAC API - Core
360361
assert api._stac_io is not None
362+
assert api._stac_io._conformance is not None
361363
api._stac_io._conformance = [api._stac_io._conformance[0]]
362364

363365
with pytest.raises(NotImplementedError) as excinfo:

Diff for: tests/test_item_search.py

+15-11
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
],
2828
}
2929

30-
ITEM_EXAMPLE = {"collections": "io-lulc", "ids": "60U-2020"}
30+
ITEM_EXAMPLE: Dict[str, Any] = {"collections": "io-lulc", "ids": "60U-2020"}
3131

3232

3333
class TestItemPerformance:
@@ -49,7 +49,9 @@ def test_single_item(self, benchmark: BenchmarkFixture, single_href: str) -> Non
4949

5050
assert item.id == ITEM_EXAMPLE["ids"]
5151

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:
5355
search = ItemSearch(url=SEARCH_URL, **ITEM_EXAMPLE)
5456

5557
item_collection = benchmark(search.get_all_items)
@@ -413,18 +415,18 @@ def test_sortby(self) -> None:
413415
)
414416

415417
with pytest.raises(Exception):
416-
ItemSearch(url=SEARCH_URL, sortby=1)
418+
ItemSearch(url=SEARCH_URL, sortby=1) # type: ignore[arg-type]
417419

418420
with pytest.raises(Exception):
419-
ItemSearch(url=SEARCH_URL, sortby=[1])
421+
ItemSearch(url=SEARCH_URL, sortby=[1]) # type: ignore[arg-type]
420422

421423
def test_fields(self) -> None:
422424

423425
with pytest.raises(Exception):
424-
ItemSearch(url=SEARCH_URL, fields=1)
426+
ItemSearch(url=SEARCH_URL, fields=1) # type: ignore[arg-type]
425427

426428
with pytest.raises(Exception):
427-
ItemSearch(url=SEARCH_URL, fields=[1])
429+
ItemSearch(url=SEARCH_URL, fields=[1]) # type: ignore[list-item]
428430

429431
search = ItemSearch(url=SEARCH_URL, fields="id,collection,+foo,-bar")
430432
assert search.get_parameters()["fields"] == {
@@ -481,7 +483,7 @@ def test_method(self) -> None:
481483
assert search.method == "GET"
482484

483485
def test_method_params(self) -> None:
484-
params_in = {
486+
params_in: Dict[str, Any] = {
485487
"bbox": (-72, 41, -71, 42),
486488
"ids": (
487489
"idone",
@@ -540,10 +542,12 @@ def test_datetime_results(self) -> None:
540542
max_datetime = datetime(2019, 1, 1, 0, 0, 10, tzinfo=tzutc())
541543
search = ItemSearch(url=SEARCH_URL, datetime=(min_datetime, max_datetime))
542544
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+
)
547551

548552
@pytest.mark.vcr # type: ignore[misc]
549553
def test_intersects_results(self) -> None:

0 commit comments

Comments
 (0)