File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,10 @@ def sar(self) -> SarExtension[Item]:
180180 def sat (self ) -> SatExtension [Item ]:
181181 return SatExtension .ext (self .stac_object )
182182
183+ @property
184+ def sci (self ) -> ScientificExtension [Item ]:
185+ return ScientificExtension .ext (self .stac_object )
186+
183187 @property
184188 def storage (self ) -> StorageExtension [Item ]:
185189 return StorageExtension .ext (self .stac_object )
Original file line number Diff line number Diff line change 77
88import pystac
99from pystac import ExtensionTypeError
10+ from pystac .errors import ExtensionNotImplemented
1011from pystac .extensions import scientific
1112from pystac .extensions .scientific import (
1213 Publication ,
@@ -494,3 +495,26 @@ def test_summaries_adds_uri(self) -> None:
494495 self .assertNotIn (
495496 ScientificExtension .get_schema_uri (), collection .stac_extensions
496497 )
498+
499+
500+ @pytest .fixture
501+ def ext_item () -> pystac .Item :
502+ path = TestCases .get_path ("data-files/scientific/item.json" )
503+ return pystac .Item .from_file (path )
504+
505+
506+ def test_ext_syntax (ext_item : pystac .Item ) -> None :
507+ assert ext_item .ext .sci .doi == "10.5061/dryad.s2v81.2/27.2"
508+
509+
510+ def test_ext_syntax_remove (ext_item : pystac .Item ) -> None :
511+ ext_item .ext .remove ("sci" )
512+ assert ext_item .ext .has ("sci" ) is False
513+ with pytest .raises (ExtensionNotImplemented ):
514+ ext_item .ext .sci
515+
516+
517+ def test_ext_syntax_add (item : pystac .Item ) -> None :
518+ item .ext .add ("sci" )
519+ assert item .ext .has ("sci" ) is True
520+ assert isinstance (item .ext .sci , ScientificExtension )
You can’t perform that action at this time.
0 commit comments