@@ -65,9 +65,9 @@ class CollectionTest(unittest.TestCase):
6565 def test_spatial_extent_from_coordinates (self ) -> None :
6666 extent = SpatialExtent .from_coordinates (ARBITRARY_GEOM ["coordinates" ])
6767
68- self . assertEqual ( len (extent .bboxes ), 1 )
68+ assert len (extent .bboxes ) == 1
6969 bbox = extent .bboxes [0 ]
70- self . assertEqual ( len (bbox ), 4 )
70+ assert len (bbox ) == 4
7171 for x in bbox :
7272 self .assertTrue (isinstance (x , float ))
7373
@@ -80,20 +80,20 @@ def test_read_eo_items_are_heritable(self) -> None:
8080 def test_save_uses_previous_catalog_type (self ) -> None :
8181 collection = TestCases .case_8 ()
8282 assert collection .STAC_OBJECT_TYPE == pystac .STACObjectType .COLLECTION
83- self . assertEqual ( collection .catalog_type , CatalogType .SELF_CONTAINED )
83+ assert collection .catalog_type == CatalogType .SELF_CONTAINED
8484 with tempfile .TemporaryDirectory () as tmp_dir :
8585 collection .normalize_hrefs (tmp_dir )
8686 href = collection .self_href
8787 collection .save ()
8888
8989 collection2 = pystac .Collection .from_file (href )
90- self . assertEqual ( collection2 .catalog_type , CatalogType .SELF_CONTAINED )
90+ assert collection2 .catalog_type == CatalogType .SELF_CONTAINED
9191
9292 def test_clone_uses_previous_catalog_type (self ) -> None :
9393 catalog = TestCases .case_8 ()
9494 assert catalog .catalog_type == CatalogType .SELF_CONTAINED
9595 clone = catalog .clone ()
96- self . assertEqual ( clone .catalog_type , CatalogType .SELF_CONTAINED )
96+ assert clone .catalog_type == CatalogType .SELF_CONTAINED
9797
9898 def test_clone_cant_mutate_original (self ) -> None :
9999 collection = TestCases .case_8 ()
@@ -130,7 +130,7 @@ def test_multiple_extents(self) -> None:
130130 extent_dict = multi_ext_dict ["extent" ]
131131 self .assertIsInstance (ext , Extent )
132132 self .assertIsInstance (ext .spatial .bboxes [0 ], list )
133- self . assertEqual ( len (ext .spatial .bboxes ), 3 )
133+ assert len (ext .spatial .bboxes ) == 3
134134 self .assertDictEqual (ext .to_dict (), extent_dict )
135135
136136 cloned_ext = ext .clone ()
@@ -149,11 +149,11 @@ def test_extra_fields(self) -> None:
149149 with open (p ) as f :
150150 col_json = json .load (f )
151151 self .assertTrue ("test" in col_json )
152- self . assertEqual ( col_json ["test" ], "extra" )
152+ assert col_json ["test" ] == "extra"
153153
154154 read_col = pystac .Collection .from_file (p )
155155 self .assertTrue ("test" in read_col .extra_fields )
156- self . assertEqual ( read_col .extra_fields ["test" ], "extra" )
156+ assert read_col .extra_fields ["test" ] == "extra"
157157
158158 def test_update_extents (self ) -> None :
159159 catalog = TestCases .case_2 ()
@@ -186,7 +186,7 @@ def test_update_extents(self) -> None:
186186 collection .add_item (item1 )
187187
188188 collection .update_extent_from_items ()
189- self . assertEqual ( [[- 180 , - 90 , 180 , 90 ]], collection .extent .spatial .bboxes )
189+ assert [[- 180 , - 90 , 180 , 90 ]] == collection .extent .spatial .bboxes
190190 self .assertEqual (
191191 len (base_extent .spatial .bboxes [0 ]), len (collection .extent .spatial .bboxes [0 ])
192192 )
@@ -221,7 +221,7 @@ def test_supplying_href_in_init_does_not_fail(self) -> None:
221221 id = "test" , description = "test desc" , extent = collection_extent , href = test_href
222222 )
223223
224- self . assertEqual ( collection .get_self_href (), test_href )
224+ assert collection .get_self_href () == test_href
225225
226226 def test_collection_with_href_caches_by_href (self ) -> None :
227227 collection = pystac .Collection .from_file (
@@ -231,7 +231,7 @@ def test_collection_with_href_caches_by_href(self) -> None:
231231
232232 # Since all of our STAC objects have HREFs, everything should be
233233 # cached only by HREF
234- self . assertEqual ( len (cache .id_keys_to_objects ), 0 )
234+ assert len (cache .id_keys_to_objects ) == 0
235235
236236 @pytest .mark .block_network
237237 def test_assets (self ) -> None :
@@ -262,7 +262,7 @@ def test_get_assets(self) -> None:
262262 assert collection .assets ["thumbnail" ].description != "foo"
263263
264264 no_assets = collection .get_assets (media_type = pystac .MediaType .HDF )
265- self . assertEqual ( no_assets , {})
265+ assert no_assets == {}
266266
267267 def test_removing_optional_attributes (self ) -> None :
268268 path = TestCases .get_path ("data-files/collections/with-assets.json" )
@@ -309,7 +309,7 @@ def test_from_dict_preserves_dict(self) -> None:
309309
310310 # test that the parameter is preserved
311311 _ = Collection .from_dict (param_dict )
312- self . assertEqual ( param_dict , collection_dict )
312+ assert param_dict == collection_dict
313313
314314 # assert that the parameter is not preserved with
315315 # non-default parameter
@@ -396,7 +396,7 @@ def test_temporal_extent_allows_single_interval(self) -> None:
396396 interval = [start_datetime , end_datetime ]
397397 temporal_extent = TemporalExtent (intervals = interval ) # type: ignore
398398
399- self . assertEqual ( temporal_extent .intervals , [interval ])
399+ assert temporal_extent .intervals == [interval ]
400400
401401 @pytest .mark .block_network ()
402402 def test_temporal_extent_allows_single_interval_open_start (self ) -> None :
@@ -405,7 +405,7 @@ def test_temporal_extent_allows_single_interval_open_start(self) -> None:
405405 interval = [None , end_datetime ]
406406 temporal_extent = TemporalExtent (intervals = interval )
407407
408- self . assertEqual ( temporal_extent .intervals , [interval ])
408+ assert temporal_extent .intervals == [interval ]
409409
410410 @pytest .mark .block_network ()
411411 def test_temporal_extent_non_list_intervals_fails (self ) -> None :
@@ -477,15 +477,13 @@ def test_from_items(self) -> None:
477477 )
478478
479479 extent = Extent .from_items ([item1 , item2 , item3 ])
480+ assert len (extent .spatial .bboxes ) == 1
481+ assert extent .spatial .bboxes [0 ] == [- 10 , - 20 , 10 , 1 ]
482+ assert len (extent .temporal .intervals ) == 1
480483
481- self .assertEqual (len (extent .spatial .bboxes ), 1 )
482- self .assertEqual (extent .spatial .bboxes [0 ], [- 10 , - 20 , 10 , 1 ])
483-
484- self .assertEqual (len (extent .temporal .intervals ), 1 )
485484 interval = extent .temporal .intervals [0 ]
486-
487- self .assertEqual (interval [0 ], datetime (2000 , 1 , 1 , 12 , 0 , 0 , 0 , tzinfo = tz .UTC ))
488- self .assertEqual (interval [1 ], datetime (2001 , 1 , 1 , 12 , 0 , 0 , 0 , tzinfo = tz .UTC ))
485+ assert interval [0 ] == datetime (2000 , 1 , 1 , 12 , 0 , 0 , 0 , tzinfo = tz .UTC )
486+ assert interval [1 ] == datetime (2001 , 1 , 1 , 12 , 0 , 0 , 0 , tzinfo = tz .UTC )
489487
490488 def test_to_from_dict (self ) -> None :
491489 spatial_dict = {
0 commit comments