@@ -79,6 +79,12 @@ def example_uri() -> str:
7979 return TestCases .get_path ("data-files/projection/example-landsat8.json" )
8080
8181
82+ @pytest .fixture
83+ def example_summaries_uri () -> str :
84+ return TestCases .get_path (
85+ "data-files/projection/collection-with-summaries.json"
86+ )
87+
8288def test_to_from_dict (example_uri : str ) -> None :
8389 with open (example_uri ) as f :
8490 d = json .load (f )
@@ -511,15 +517,8 @@ def test_should_raise_exception_when_passing_invalid_extension_object() -> None:
511517 # intentionally calling this wrong so ---vvv
512518 ProjectionExtension .ext (object ()) # type: ignore
513519
514-
515- #class TestProjectionSummaries(unittest.TestCase):
516- # def setUp(self) -> None:
517- # self.example_uri = TestCases.get_path(
518- # "data-files/projection/collection-with-summaries.json"
519- # )
520-
521- def test_get_summaries (self ) -> None :
522- col = pystac .Collection .from_file (self .example_uri )
520+ def test_get_summaries (example_summaries_uri : str ) -> None :
521+ col = pystac .Collection .from_file (example_summaries_uri )
523522 proj_summaries = ProjectionExtension .summaries (col )
524523
525524 # Get
@@ -528,8 +527,8 @@ def test_get_summaries(self) -> None:
528527 assert epsg_summaries is not None
529528 assert epsg_summaries == [32614 ]
530529
531- def test_set_summaries (self ) -> None :
532- col = pystac .Collection .from_file (self . example_uri )
530+ def test_set_summaries (example_summaries_uri : str ) -> None :
531+ col = pystac .Collection .from_file (example_summaries_uri )
533532 proj_summaries = ProjectionExtension .summaries (col )
534533
535534 # Set
@@ -539,8 +538,8 @@ def test_set_summaries(self) -> None:
539538 col_dict = col .to_dict ()
540539 assert col_dict ["summaries" ]["proj:code" ] == ["EPSG:4326" ]
541540
542- def test_summaries_adds_uri (self ) -> None :
543- col = pystac .Collection .from_file (self . example_uri )
541+ def test_summaries_adds_uri (example_summaries_uri : str ) -> None :
542+ col = pystac .Collection .from_file (example_summaries_uri )
544543 col .stac_extensions = []
545544 with pytest .raises (
546545 pystac .ExtensionNotImplemented , match = "Extension 'proj' is not implemented"
0 commit comments