Skip to content

Commit 9a3b7ca

Browse files
committed
993 finish converting test_catalog.py:
by converting CatalogSubClassTest to pytest
1 parent 61f6f47 commit 9a3b7ca

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

tests/test_catalog.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55
import posixpath
66
import tempfile
7-
import unittest
87
from collections import defaultdict
98
from collections.abc import Iterator
109
from copy import deepcopy
@@ -1540,7 +1539,7 @@ def test_full_copy_4(self) -> None:
15401539
assert os.path.exists(href)
15411540

15421541

1543-
class CatalogSubClassTest(unittest.TestCase):
1542+
class TestCatalogSubClass:
15441543
"""This tests cases related to creating classes inheriting from pystac.Catalog to
15451544
ensure that inheritance, class methods, etc. function as expected."""
15461545

@@ -1553,25 +1552,20 @@ def get_items(self) -> Iterator[Item]: # type: ignore
15531552
# backwards compatibility of inherited classes
15541553
return super().get_items()
15551554

1556-
def setUp(self) -> None:
1557-
self.stac_io = pystac.StacIO.default()
1558-
15591555
def test_from_dict_returns_subclass(self) -> None:
1556+
self.stac_io = pystac.StacIO.default()
15601557
catalog_dict = self.stac_io.read_json(self.case_1)
15611558
custom_catalog = self.BasicCustomCatalog.from_dict(catalog_dict)
1562-
1563-
self.assertIsInstance(custom_catalog, self.BasicCustomCatalog)
1559+
assert isinstance(custom_catalog, self.BasicCustomCatalog)
15641560

15651561
def test_from_file_returns_subclass(self) -> None:
15661562
custom_catalog = self.BasicCustomCatalog.from_file(self.case_1)
1567-
1568-
self.assertIsInstance(custom_catalog, self.BasicCustomCatalog)
1563+
assert isinstance(custom_catalog, self.BasicCustomCatalog)
15691564

15701565
def test_clone(self) -> None:
15711566
custom_catalog = self.BasicCustomCatalog.from_file(self.case_1)
15721567
cloned_catalog = custom_catalog.clone()
1573-
1574-
self.assertIsInstance(cloned_catalog, self.BasicCustomCatalog)
1568+
assert isinstance(cloned_catalog, self.BasicCustomCatalog)
15751569

15761570
def test_get_all_items_works(self) -> None:
15771571
custom_catalog = self.BasicCustomCatalog.from_file(self.case_1)

0 commit comments

Comments
 (0)