Skip to content

Commit 8cc78ac

Browse files
committed
Increase test coverage and ignore htmlcov directory
1 parent af1ab82 commit 8cc78ac

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ stdout*
1010
.idea
1111
.vscode
1212

13+
1314
# Sphinx documentation
1415
.ipynb_checkpoints/
1516

tests/serialization/test_identify.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,35 @@ def test_identify_non_stac_raises_error(self) -> None:
6868

6969
self.assertIn("JSON does not represent a STAC object", str(ctx.exception))
7070

71+
def test_identify_0_8_itemcollection(self) -> None:
72+
itemcollection_path = TestCases.get_path(
73+
"data-files/examples/0.8.1/item-spec/"
74+
"examples/itemcollection-sample-full.json"
75+
)
76+
itemcollection_dict = pystac.StacIO.default().read_json(itemcollection_path)
77+
78+
self.assertEqual(
79+
identify_stac_object_type(itemcollection_dict),
80+
pystac.STACObjectType.ITEMCOLLECTION,
81+
)
82+
83+
def test_identify_0_9_itemcollection(self) -> None:
84+
itemcollection_path = TestCases.get_path(
85+
"data-files/examples/0.9.0/item-spec/"
86+
"examples/itemcollection-sample-full.json"
87+
)
88+
itemcollection_dict = pystac.StacIO.default().read_json(itemcollection_path)
89+
90+
self.assertEqual(
91+
identify_stac_object_type(itemcollection_dict),
92+
pystac.STACObjectType.ITEMCOLLECTION,
93+
)
94+
95+
def test_identify_invalid_with_stac_version(self) -> None:
96+
not_stac = {"stac_version": "0.9.0", "type": "Custom"}
97+
98+
self.assertIsNone(identify_stac_object_type(not_stac))
99+
71100

72101
class VersionTest(unittest.TestCase):
73102
def test_version_ordering(self) -> None:

0 commit comments

Comments
 (0)