File tree 2 files changed +17
-1
lines changed 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -180,11 +180,13 @@ def __repr__(self) -> str:
180
180
return "<Catalog id={}>" .format (self .id )
181
181
182
182
def set_root (self , root : Optional ["Catalog" ]) -> None :
183
- STACObject .set_root (self , root )
183
+ super () .set_root (root )
184
184
if root is not None :
185
185
root ._resolved_objects = ResolvedObjectCache .merge (
186
186
root ._resolved_objects , self ._resolved_objects
187
187
)
188
+ if root ._stac_io is not None :
189
+ self ._stac_io = root ._stac_io
188
190
189
191
def is_relative (self ) -> bool :
190
192
return self .catalog_type in [
Original file line number Diff line number Diff line change 18
18
HIERARCHICAL_LINKS ,
19
19
)
20
20
from pystac .extensions .label import LabelClasses , LabelExtension , LabelType
21
+ from pystac .stac_io import DefaultStacIO
21
22
from pystac .utils import is_absolute_href , join_path_or_url , JoinType
22
23
from tests .utils import (
23
24
TestCases ,
@@ -107,6 +108,19 @@ def test_from_dict_set_root(self) -> None:
107
108
collection = Catalog .from_dict (cat_dict , root = root_cat )
108
109
self .assertIs (collection .get_root (), root_cat )
109
110
111
+ def test_from_dict_uses_root_stac_io (self ) -> None :
112
+ class CustomStacIO (DefaultStacIO ):
113
+ pass
114
+
115
+ path = TestCases .get_path ("data-files/catalogs/test-case-1/catalog.json" )
116
+ with open (path ) as f :
117
+ cat_dict = json .load (f )
118
+ root_cat = pystac .Catalog (id = "test" , description = "test desc" )
119
+ root_cat ._stac_io = CustomStacIO ()
120
+
121
+ collection = Catalog .from_dict (cat_dict , root = root_cat )
122
+ self .assertIsInstance (collection ._stac_io , CustomStacIO )
123
+
110
124
def test_read_remote (self ) -> None :
111
125
# TODO: Move this URL to the main stac-spec repo once the example JSON is fixed.
112
126
catalog_url = (
You can’t perform that action at this time.
0 commit comments