diff --git a/tests/extensions/test_grid.py b/tests/extensions/test_grid.py index e2edb9610..77a9defce 100644 --- a/tests/extensions/test_grid.py +++ b/tests/extensions/test_grid.py @@ -1,4 +1,6 @@ """Tests for pystac.extensions.grid.""" +# This is for the type checking on GridTest.test_clear_code +# mypy: warn_unused_ignores=False import datetime from typing import Any, Dict @@ -86,7 +88,22 @@ def test_clear_code(self) -> None: GridExtension.ext(self.item).apply(code) with self.assertRaises(ValueError): - GridExtension.ext(self.item).code = None + # Ignore type errors because this test intentionally checks behavior + # that does not conform to the type signature. + # https://github.com/stac-utils/pystac/pull/878#discussion_r957352232 + GridExtension.ext(self.item).code = None # type: ignore + with self.assertRaises(ValueError): + # First segment has to be all caps + # https://github.com/stac-utils/pystac/pull/878#discussion_r957354927 + GridExtension.ext(self.item).code = "this-is-not-a-grid-code" + with self.assertRaises(ValueError): + # Folks might try to put an epsg code in + # https://github.com/stac-utils/pystac/pull/878#discussion_r957355415 + GridExtension.ext(self.item).code = "4326" + with self.assertRaises(ValueError): + # Folks might try to put an epsg code in + # https://github.com/stac-utils/pystac/pull/878#discussion_r957355415 + GridExtension.ext(self.item).code = "EPSG:4326" def test_extension_not_implemented(self) -> None: # Should raise exception if Item does not include extension URI