File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,3 +128,24 @@ def test_load_yaml_recursion(tmp_path, tagged):
128128 tree = util .load_yaml (fn , tagged = tagged )
129129 assert tree ["d" ]["d" ] is tree ["d" ]
130130 assert tree ["l" ][0 ] is tree ["l" ]
131+
132+
133+ @pytest .mark .parametrize ("tagged" , [True , False ])
134+ def test_load_yaml_recursion_with_tags (tagged ):
135+ contents = b"""#ASDF 1.0.0
136+ #ASDF_STANDARD 1.6.0
137+ %YAML 1.1
138+ %TAG ! tag:stsci.edu:asdf/
139+ --- !core/asdf-1.1.0
140+ o: &id001 !transform/remap_axes-1.4.0
141+ inputs: [x0, x1]
142+ inverse: !transform/remap_axes-1.4.0
143+ inputs: [x0, x1, x2]
144+ inverse: *id001
145+ mapping: [2, 1]
146+ outputs: [x0, x1]
147+ mapping: [0, 1, 0]
148+ outputs: [x0, x1, x2]
149+ ..."""
150+ tree = util .load_yaml (io .BytesIO (contents ), tagged = tagged )
151+ assert tree ["o" ] is tree ["o" ]["inverse" ]["inverse" ]
Original file line number Diff line number Diff line change @@ -147,9 +147,9 @@ class _IgnoreCustomTagsLoader(_yaml_base_loader):
147147
148148 def construct_undefined (self , node ):
149149 if isinstance (node , yaml .MappingNode ):
150- return self .construct_mapping (node )
150+ return self .construct_yaml_map (node )
151151 elif isinstance (node , yaml .SequenceNode ):
152- return self .construct_sequence (node )
152+ return self .construct_yaml_seq (node )
153153 elif isinstance (node , yaml .ScalarNode ):
154154 return self .construct_scalar (node )
155155 return super ().construct_undefined (node )
You can’t perform that action at this time.
0 commit comments