@@ -22,6 +22,39 @@ def test_stac_io_issues_warnings(self) -> None:
22
22
self .assertEqual (len (w ), 1 )
23
23
self .assertTrue (issubclass (w [- 1 ].category , DeprecationWarning ))
24
24
25
+ with warnings .catch_warnings (record = True ) as w :
26
+ # Cause all warnings to always be triggered.
27
+ warnings .simplefilter ("always" )
28
+ # Trigger instantiation warning.
29
+ _ = STAC_IO ()
30
+
31
+ self .assertEqual (len (w ), 1 )
32
+ self .assertTrue (issubclass (w [- 1 ].category , DeprecationWarning ))
33
+
34
+ with warnings .catch_warnings (record = True ) as w :
35
+ # Cause all warnings to always be triggered.
36
+ warnings .simplefilter ("always" )
37
+
38
+ class CustomSTAC_IO (STAC_IO ):
39
+ pass
40
+
41
+ self .assertEqual (len (w ), 1 )
42
+ self .assertTrue (issubclass (w [- 1 ].category , DeprecationWarning ))
43
+
44
+ with warnings .catch_warnings (record = True ) as w :
45
+ # Cause all warnings to always be triggered.
46
+ warnings .simplefilter ("always" )
47
+
48
+ d = STAC_IO .read_json (
49
+ TestCases .get_path ("data-files/item/sample-item.json" )
50
+ )
51
+ _ = STAC_IO .stac_object_from_dict (d )
52
+
53
+ self .assertEqual (len (w ), 3 )
54
+ self .assertTrue (
55
+ all (issubclass (wrn .category , DeprecationWarning ) for wrn in w )
56
+ )
57
+
25
58
def test_read_write_collection (self ) -> None :
26
59
collection = pystac .read_file (
27
60
TestCases .get_path ("data-files/collections/multi-extent.json" )
0 commit comments