@@ -45,6 +45,28 @@ def test_example(self) -> None:
4545 ),
4646 )
4747
48+ def test_set_using_dict (self ) -> None :
49+ collection = self .collection .clone ()
50+
51+ assert collection .item_assets
52+ self .assertEqual (len (collection .item_assets ), 13 )
53+
54+ collection .item_assets ["Bx" ] = {
55+ "type" : "image/tiff; application=geotiff" ,
56+ "eo:bands" : [
57+ {
58+ "name" : "B1" ,
59+ "common_name" : "coastal" ,
60+ "center_wavelength" : 0.44 ,
61+ "full_width_half_max" : 0.02 ,
62+ }
63+ ],
64+ "title" : "Coastal Band (B1)" ,
65+ "description" : "Coastal Band Top Of the Atmosphere" ,
66+ } # type:ignore
67+
68+ self .assertEqual (collection .item_assets ["B1" ], collection .item_assets ["Bx" ])
69+
4870
4971class TestAssetDefinition (unittest .TestCase ):
5072 def setUp (self ) -> None :
@@ -130,14 +152,14 @@ def test_item_assets_extension_is_deprecated() -> None:
130152
131153 assert ItemAssetsExtension .get_schema_uri () not in collection .stac_extensions
132154
133- with pytest .warns (DeprecatedWarning , match = "top-level collection properties " ):
155+ with pytest .warns (DeprecatedWarning , match = "top-level property of " ):
134156 item_asset = ItemAssetsExtension .ext (
135157 collection , add_if_missing = True
136158 ).item_assets ["cloud-mask-raster" ]
137159
138160 assert item_asset .ext .has ("eo" )
139161
140- with pytest .warns (DeprecatedWarning , match = "top-level collection properties " ):
162+ with pytest .warns (DeprecatedWarning , match = "top-level property of " ):
141163 assert collection .ext .item_assets ["cloud-mask-raster" ].ext .has ("eo" )
142164
143165 assert ItemAssetsExtension .get_schema_uri () in collection .stac_extensions
0 commit comments