diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d1279eb8..bade5712c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,6 @@ - Enable [strict mode](https://mypy.readthedocs.io/en/latest/command_line.html?highlight=strict%20mode#cmdoption-mypy-strict) for `mypy` ([#591](https://github.com/stac-utils/pystac/pull/591)) -- `Catalog.set_root` also sets `Catalog.stac_io` for the calling instance to be the same - as `root.stac_io`, if that value is not `None` - ([#590](https://github.com/stac-utils/pystac/pull/590)) - Links will get their `title` from their target if no `title` is provided ([#607](https://github.com/stac-utils/pystac/pull/607)) - Relax typing on `LabelClasses` from `List` to `Sequence` ([#627](https://github.com/stac-utils/pystac/pull/627)) diff --git a/pystac/catalog.py b/pystac/catalog.py index 7e2ec388b..a76ffef38 100644 --- a/pystac/catalog.py +++ b/pystac/catalog.py @@ -45,7 +45,7 @@ class CatalogType(str, Enum): See: :stac-spec:`The best practices documentation on self-contained catalogs - ` + ` """ ABSOLUTE_PUBLISHED = "ABSOLUTE_PUBLISHED" @@ -55,7 +55,7 @@ class CatalogType(str, Enum): See: :stac-spec:`The best practices documentation on published catalogs - ` + ` """ RELATIVE_PUBLISHED = "RELATIVE_PUBLISHED" @@ -65,7 +65,7 @@ class CatalogType(str, Enum): See: :stac-spec:`The best practices documentation on published catalogs - ` + ` """ @classmethod @@ -181,13 +181,11 @@ def __repr__(self) -> str: return "".format(self.id) def set_root(self, root: Optional["Catalog"]) -> None: - super().set_root(root) + STACObject.set_root(self, root) if root is not None: root._resolved_objects = ResolvedObjectCache.merge( root._resolved_objects, self._resolved_objects ) - if root._stac_io is not None: - self._stac_io = root._stac_io def is_relative(self) -> bool: return self.catalog_type in [ diff --git a/tests/test_catalog.py b/tests/test_catalog.py index 39c4c38d4..d75051747 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -18,7 +18,6 @@ HIERARCHICAL_LINKS, ) from pystac.extensions.label import LabelClasses, LabelExtension, LabelType -from pystac.stac_io import DefaultStacIO from pystac.utils import is_absolute_href, join_path_or_url, JoinType from tests.utils import ( TestCases, @@ -108,19 +107,6 @@ def test_from_dict_set_root(self) -> None: collection = Catalog.from_dict(cat_dict, root=root_cat) self.assertIs(collection.get_root(), root_cat) - def test_from_dict_uses_root_stac_io(self) -> None: - class CustomStacIO(DefaultStacIO): - pass - - path = TestCases.get_path("data-files/catalogs/test-case-1/catalog.json") - with open(path) as f: - cat_dict = json.load(f) - root_cat = pystac.Catalog(id="test", description="test desc") - root_cat._stac_io = CustomStacIO() - - collection = Catalog.from_dict(cat_dict, root=root_cat) - self.assertIsInstance(collection._stac_io, CustomStacIO) - def test_read_remote(self) -> None: # TODO: Move this URL to the main stac-spec repo once the example JSON is fixed. catalog_url = (