Skip to content

Commit f832683

Browse files
committed
Improve test coverage
1 parent d053e72 commit f832683

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/test_stac_io.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,39 @@ def test_stac_io_issues_warnings(self) -> None:
2222
self.assertEqual(len(w), 1)
2323
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
2424

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+
2558
def test_read_write_collection(self) -> None:
2659
collection = pystac.read_file(
2760
TestCases.get_path("data-files/collections/multi-extent.json")

0 commit comments

Comments
 (0)