@@ -552,10 +552,10 @@ def test_summaries_adds_uri(self) -> None:
552
552
553
553
def test_older_extension_version (projection_landsat8_item : Item ) -> None :
554
554
old = "https://stac-extensions.github.io/projection/v1.0.0/schema.json"
555
- new = "https://stac-extensions.github.io/projection/v1.1.0/schema.json"
555
+ current = "https://stac-extensions.github.io/projection/v1.1.0/schema.json"
556
556
557
557
stac_extensions = set (projection_landsat8_item .stac_extensions )
558
- stac_extensions .remove (new )
558
+ stac_extensions .remove (current )
559
559
stac_extensions .add (old )
560
560
item_as_dict = projection_landsat8_item .to_dict (
561
561
include_self_link = False , transform_hrefs = False
@@ -565,6 +565,26 @@ def test_older_extension_version(projection_landsat8_item: Item) -> None:
565
565
assert ProjectionExtension .has_extension (item )
566
566
assert old in item .stac_extensions
567
567
568
+ migrated_item = pystac .Item .from_dict (item_as_dict , migrate = True )
569
+ assert ProjectionExtension .has_extension (migrated_item )
570
+ assert current in migrated_item .stac_extensions
571
+
572
+
573
+ def test_newer_extension_version (projection_landsat8_item : Item ) -> None :
574
+ new = "https://stac-extensions.github.io/projection/v2.0.0/schema.json"
575
+ current = "https://stac-extensions.github.io/projection/v1.1.0/schema.json"
576
+
577
+ stac_extensions = set (projection_landsat8_item .stac_extensions )
578
+ stac_extensions .remove (current )
579
+ stac_extensions .add (new )
580
+ item_as_dict = projection_landsat8_item .to_dict (
581
+ include_self_link = False , transform_hrefs = False
582
+ )
583
+ item_as_dict ["stac_extensions" ] = list (stac_extensions )
584
+ item = Item .from_dict (item_as_dict )
585
+ assert ProjectionExtension .has_extension (item )
586
+ assert new in item .stac_extensions
587
+
568
588
migrated_item = pystac .Item .from_dict (item_as_dict , migrate = True )
569
589
assert ProjectionExtension .has_extension (migrated_item )
570
590
assert new in migrated_item .stac_extensions
0 commit comments