-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bug where a dict with an id causes contained refs to fail to resolve
- Loading branch information
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import asdf | ||
|
||
|
||
def test_id_in_tree_breaks_ref(tmp_path): | ||
""" | ||
a dict containing id will break contained References | ||
https://github.com/asdf-format/asdf/issues/1715 | ||
""" | ||
external_fn = tmp_path / "external.asdf" | ||
|
||
external_tree = {"thing": 42} | ||
|
||
asdf.AsdfFile(external_tree).write_to(external_fn) | ||
|
||
uri = asdf.util.filepath_to_url(str(tmp_path / "main.asdf")) | ||
af = asdf.AsdfFile({}, uri=uri) | ||
af["id"] = "bogus" | ||
af["myref"] = {"$ref": "external.asdf#/thing"} | ||
af.find_references() | ||
af.resolve_references() | ||
assert af["myref"] == 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters