From 70b4888736ef3aab1108958307e97b0d95d3c2de Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 7 Feb 2024 16:54:16 -0500 Subject: [PATCH] switch default asdf-standard to 1.6.0 --- asdf/_tests/core/_converters/test_tree.py | 3 +- asdf/_tests/tags/core/tests/test_ndarray.py | 56 ++++++++++----------- asdf/_tests/test_history.py | 2 +- asdf/_tests/test_info.py | 9 +++- asdf/_tests/test_schema.py | 24 +++++---- asdf/_tests/test_types.py | 4 +- asdf/_tests/test_yaml.py | 2 +- asdf/versioning.py | 4 +- docs/asdf/config.rst | 6 +-- 9 files changed, 60 insertions(+), 50 deletions(-) diff --git a/asdf/_tests/core/_converters/test_tree.py b/asdf/_tests/core/_converters/test_tree.py index bcd7238f0..51231c69a 100644 --- a/asdf/_tests/core/_converters/test_tree.py +++ b/asdf/_tests/core/_converters/test_tree.py @@ -76,6 +76,7 @@ def test_history_entry(): def test_subclass_metadata(): subclass_metadata = SubclassMetadata(name="SomeCoolSubclass") - result = helpers.roundtrip_object(subclass_metadata) + # support for this was dropped in 1.6.0 + result = helpers.roundtrip_object(subclass_metadata, version="1.5.0") assert result == subclass_metadata diff --git a/asdf/_tests/tags/core/tests/test_ndarray.py b/asdf/_tests/tags/core/tests/test_ndarray.py index 7be0ed927..82afaad7f 100644 --- a/asdf/_tests/tags/core/tests/test_ndarray.py +++ b/asdf/_tests/tags/core/tests/test_ndarray.py @@ -289,7 +289,7 @@ class NDArrayContainerExtension: def test_copy_inline(): yaml = """ -x0: !core/ndarray-1.0.0 +x0: !core/ndarray-1.1.0 data: [-1.0, 1.0] """ @@ -378,7 +378,7 @@ def test_inline(): def test_inline_bare(): - content = "arr: !core/ndarray-1.0.0 [[1, 2, 3, 4], [5, 6, 7, 8]]" + content = "arr: !core/ndarray-1.1.0 [[1, 2, 3, 4], [5, 6, 7, 8]]" buff = helpers.yaml_to_asdf(content) with asdf.open(buff) as ff: @@ -410,7 +410,7 @@ def test_len_roundtrip(tmpdir): def test_mask_arbitrary(): content = """ -arr: !core/ndarray-1.0.0 +arr: !core/ndarray-1.1.0 data: [[1, 2, 3, 1234], [5, 6, 7, 8]] mask: 1234 """ @@ -422,7 +422,7 @@ def test_mask_arbitrary(): def test_mask_nan(): content = """ -arr: !core/ndarray-1.0.0 +arr: !core/ndarray-1.1.0 data: [[1, 2, 3, .NaN], [5, 6, 7, 8]] mask: .NaN """ @@ -452,7 +452,7 @@ def test_string_table(tmpdir): def test_inline_string(): - content = "arr: !core/ndarray-1.0.0 ['a', 'b', 'c']" + content = "arr: !core/ndarray-1.1.0 ['a', 'b', 'c']" buff = helpers.yaml_to_asdf(content) with asdf.open(buff) as ff: @@ -461,7 +461,7 @@ def test_inline_string(): def test_inline_structured(): content = """ -arr: !core/ndarray-1.0.0 +arr: !core/ndarray-1.1.0 datatype: [['ascii', 4], uint16, uint16, ['ascii', 4]] data: [[M110, 110, 205, And], [ M31, 31, 224, And], @@ -618,10 +618,10 @@ def test_operations_on_ndarray_proxies(tmpdir): def test_mask_datatype(tmpdir): content = """ -arr: !core/ndarray-1.0.0 +arr: !core/ndarray-1.1.0 data: [1, 2, 3] dtype: int32 - mask: !core/ndarray-1.0.0 + mask: !core/ndarray-1.1.0 data: [true, true, false] """ buff = helpers.yaml_to_asdf(content) @@ -632,10 +632,10 @@ def test_mask_datatype(tmpdir): def test_invalid_mask_datatype(tmpdir): content = """ -arr: !core/ndarray-1.0.0 +arr: !core/ndarray-1.1.0 data: [1, 2, 3] dtype: int32 - mask: !core/ndarray-1.0.0 + mask: !core/ndarray-1.1.0 data: ['a', 'b', 'c'] """ buff = helpers.yaml_to_asdf(content) @@ -650,7 +650,7 @@ def test_invalid_mask_datatype(tmpdir): def test_ndim_validation(tmpdir): content = """ obj: ! - a: !core/ndarray-1.0.0 + a: !core/ndarray-1.1.0 data: [1, 2, 3] """ buff = helpers.yaml_to_asdf(content) @@ -662,7 +662,7 @@ def test_ndim_validation(tmpdir): content = """ obj: ! - a: !core/ndarray-1.0.0 + a: !core/ndarray-1.1.0 data: [[1, 2, 3]] """ buff = helpers.yaml_to_asdf(content) @@ -672,7 +672,7 @@ def test_ndim_validation(tmpdir): content = """ obj: ! - a: !core/ndarray-1.0.0 + a: !core/ndarray-1.1.0 shape: [1, 3] data: [[1, 2, 3]] """ @@ -683,7 +683,7 @@ def test_ndim_validation(tmpdir): content = """ obj: ! - b: !core/ndarray-1.0.0 + b: !core/ndarray-1.1.0 data: [1, 2, 3] """ buff = helpers.yaml_to_asdf(content) @@ -693,7 +693,7 @@ def test_ndim_validation(tmpdir): content = """ obj: ! - b: !core/ndarray-1.0.0 + b: !core/ndarray-1.1.0 data: [[1, 2, 3]] """ buff = helpers.yaml_to_asdf(content) @@ -703,7 +703,7 @@ def test_ndim_validation(tmpdir): content = """ obj: ! - b: !core/ndarray-1.0.0 + b: !core/ndarray-1.1.0 data: [[[1, 2, 3]]] """ buff = helpers.yaml_to_asdf(content) @@ -718,7 +718,7 @@ def test_ndim_validation(tmpdir): def test_datatype_validation(tmpdir): content = """ obj: ! - a: !core/ndarray-1.0.0 + a: !core/ndarray-1.1.0 data: [1, 2, 3] datatype: float32 """ @@ -729,7 +729,7 @@ def test_datatype_validation(tmpdir): content = """ obj: ! - a: !core/ndarray-1.0.0 + a: !core/ndarray-1.1.0 data: [1, 2, 3] datatype: float64 """ @@ -742,7 +742,7 @@ def test_datatype_validation(tmpdir): content = """ obj: ! - a: !core/ndarray-1.0.0 + a: !core/ndarray-1.1.0 data: [1, 2, 3] datatype: int16 """ @@ -753,7 +753,7 @@ def test_datatype_validation(tmpdir): content = """ obj: ! - b: !core/ndarray-1.0.0 + b: !core/ndarray-1.1.0 data: [1, 2, 3] datatype: int16 """ @@ -766,7 +766,7 @@ def test_datatype_validation(tmpdir): content = """ obj: ! - a: !core/ndarray-1.0.0 + a: !core/ndarray-1.1.0 data: [[1, 'a'], [2, 'b'], [3, 'c']] datatype: - name: a @@ -786,7 +786,7 @@ def test_datatype_validation(tmpdir): def test_structured_datatype_validation(tmpdir): content = """ obj: ! - c: !core/ndarray-1.0.0 + c: !core/ndarray-1.1.0 data: [[1, 'a'], [2, 'b'], [3, 'c']] datatype: - name: a @@ -801,7 +801,7 @@ def test_structured_datatype_validation(tmpdir): content = """ obj: ! - c: !core/ndarray-1.0.0 + c: !core/ndarray-1.1.0 data: [[1, 'a'], [2, 'b'], [3, 'c']] datatype: - name: a @@ -818,7 +818,7 @@ def test_structured_datatype_validation(tmpdir): content = """ obj: ! - c: !core/ndarray-1.0.0 + c: !core/ndarray-1.1.0 data: [[1, 'a', 0], [2, 'b', 1], [3, 'c', 2]] datatype: - name: a @@ -837,7 +837,7 @@ def test_structured_datatype_validation(tmpdir): content = """ obj: ! - c: !core/ndarray-1.0.0 + c: !core/ndarray-1.1.0 data: [1, 2, 3] """ buff = helpers.yaml_to_asdf(content) @@ -849,7 +849,7 @@ def test_structured_datatype_validation(tmpdir): content = """ obj: ! - d: !core/ndarray-1.0.0 + d: !core/ndarray-1.1.0 data: [[1, 'a'], [2, 'b'], [3, 'c']] datatype: - name: a @@ -866,7 +866,7 @@ def test_structured_datatype_validation(tmpdir): content = """ obj: ! - d: !core/ndarray-1.0.0 + d: !core/ndarray-1.1.0 data: [[1, 'a'], [2, 'b'], [3, 'c']] datatype: - name: a @@ -890,7 +890,7 @@ def test_string_inline(): def test_inline_shape_mismatch(): content = """ -arr: !core/ndarray-1.0.0 +arr: !core/ndarray-1.1.0 data: [1, 2, 3] shape: [2] """ diff --git a/asdf/_tests/test_history.py b/asdf/_tests/test_history.py index 2f1120717..ca08bd7b5 100644 --- a/asdf/_tests/test_history.py +++ b/asdf/_tests/test_history.py @@ -108,7 +108,7 @@ def test_extension_metadata(tmp_path): with asdf.open(file_path) as af: assert len(af.tree["history"]["extensions"]) == 1 metadata = af.tree["history"]["extensions"][0] - assert metadata.extension_uri == "asdf://asdf-format.org/core/extensions/core-1.5.0" + assert metadata.extension_uri == "asdf://asdf-format.org/core/extensions/core-1.6.0" assert metadata.extension_class == "asdf.extension._manifest.ManifestExtension" assert metadata.software["name"] == "asdf" assert metadata.software["version"] == asdf.__version__ diff --git a/asdf/_tests/test_info.py b/asdf/_tests/test_info.py index 79a89273d..50f44bd10 100644 --- a/asdf/_tests/test_info.py +++ b/asdf/_tests/test_info.py @@ -647,7 +647,14 @@ def test_recursive_info_object_support(capsys, tmp_path): recursive_obj = RecursiveObjectWithInfoSupport() recursive_obj.recursive = recursive_obj tree = {"random": 3.14159, "rtest": recursive_obj} - af = asdf.AsdfFile(tree) + af = asdf.AsdfFile() + # we need to do this to avoid validation against the + # manifest (generated in manifest_extension) which is + # now supported with the default asdf standard 1.6.0 + # I'm not sure why the manifest has this restriction + # and prior to switching to the default 1.6.0 was ignored + # which allowed this test to pass. + af._tree = tree af.info(refresh_extension_manager=True) captured = capsys.readouterr() assert "recursive reference" in captured.out diff --git a/asdf/_tests/test_schema.py b/asdf/_tests/test_schema.py index 82cea9238..26323929d 100644 --- a/asdf/_tests/test_schema.py +++ b/asdf/_tests/test_schema.py @@ -52,7 +52,7 @@ class TagReferenceExtension: name: type: string things: - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.0.0" + $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" required: [name, things] ... """ @@ -125,7 +125,7 @@ def test_load_schema(tmp_path): type: object properties: foobar: - $ref: "../core/ndarray-1.0.0" + $ref: "../core/ndarray-1.1.0" required: [foobar] ... @@ -148,7 +148,7 @@ def test_load_schema_with_full_tag(tmp_path): type: object properties: foobar: - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0" + $ref: "tag:stsci.edu:asdf/core/ndarray-1.1.0" required: [foobar] ... @@ -173,7 +173,7 @@ def test_load_schema_with_file_url(tmp_path): type: object properties: foobar: - $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.0.0" + $ref: "http://stsci.edu/schemas/asdf/core/ndarray-1.1.0" required: [foobar] ... @@ -402,7 +402,7 @@ def test_property_order(): ff = asdf.AsdfFile(tree) ff.write_to(buff) - ndarray_schema = schema.load_schema("http://stsci.edu/schemas/asdf/core/ndarray-1.0.0") + ndarray_schema = schema.load_schema("http://stsci.edu/schemas/asdf/core/ndarray-1.1.0") property_order = ndarray_schema["anyOf"][1]["propertyOrder"] last_index = 0 @@ -469,7 +469,7 @@ class CustomExtension: # Make sure tags get validated inside of other tags that know # nothing about them. yaml = f""" - array: !core/ndarray-1.0.0 + array: !core/ndarray-1.1.0 data: [0, 1, 2] custom: !<{tag_uri}> foo @@ -529,7 +529,7 @@ def test_check_complex_default(): schema.check_schema(s) - s["properties"]["a"]["tag"] = "tag:stsci.edu/asdf/core/ndarray-1.0.0" + s["properties"]["a"]["tag"] = "tag:stsci.edu/asdf/core/ndarray-1.1.0" with pytest.raises(ValidationError, match=r"mismatched tags, wanted .*, got .*"): schema.check_schema(s) @@ -616,6 +616,8 @@ class DefaultExtension: extension_uri = "http://nowhere.org/extensions/custom/default-1.0.0" with config_context() as cfg: + # later versions do not fill defaults + cfg.default_version = "1.5.0" cfg.add_extension(DefaultExtension()) cfg.add_resource_mapping({schema_uri: tag_schema}) yaml = """ @@ -626,7 +628,7 @@ class DefaultExtension: j: l: 362 """ - buff = helpers.yaml_to_asdf(yaml) + buff = helpers.yaml_to_asdf(yaml, standard_version="1.5.0") with asdf.open(buff) as ff: assert "a" in ff.tree["custom"] assert ff.tree["custom"]["a"] == 42 @@ -748,7 +750,7 @@ def test_tag_reference_validation(): custom: ! name: "Something" - things: !core/ndarray-1.0.0 + things: !core/ndarray-1.1.0 data: [1, 2, 3] """ @@ -805,7 +807,7 @@ class ForeignTagReferenceExtension: a: ! name: "Something" - things: !core/ndarray-1.0.0 + things: !core/ndarray-1.1.0 data: [1, 2, 3] """ @@ -837,7 +839,7 @@ def test_schema_resolved_via_entry_points(): schema_uris = extension_manager.get_tag_definition(tag).schema_uris assert len(schema_uris) > 0 s = schema.load_schema(schema_uris[0], resolve_references=True) - assert tag in repr(s) + assert "fits" in s["id"] @pytest.mark.parametrize("num", [constants.MAX_NUMBER + 1, constants.MIN_NUMBER - 1]) diff --git a/asdf/_tests/test_types.py b/asdf/_tests/test_types.py index b20fdb43b..2c63559f6 100644 --- a/asdf/_tests/test_types.py +++ b/asdf/_tests/test_types.py @@ -17,10 +17,10 @@ def test_undefined_tag(): ! - 5 - {'message': 'there is no tag'} - - !core/ndarray-1.0.0 + - !core/ndarray-1.1.0 [[1, 2, 3], [4, 5, 6]] - ! - - !core/ndarray-1.0.0 [[7],[8],[9],[10]] + - !core/ndarray-1.1.0 [[7],[8],[9],[10]] - !core/complex-1.0.0 3.14j """ buff = helpers.yaml_to_asdf(yaml) diff --git a/asdf/_tests/test_yaml.py b/asdf/_tests/test_yaml.py index a4f9f7e31..cf79ba048 100644 --- a/asdf/_tests/test_yaml.py +++ b/asdf/_tests/test_yaml.py @@ -202,7 +202,7 @@ def test_explicit_tags(): yaml = f"""#ASDF {asdf.versioning.default_version} %YAML 1.1 --- ! -foo: ! [1, 2, 3] +foo: ! [1, 2, 3] ...""" # Check that fully qualified explicit tags work diff --git a/asdf/versioning.py b/asdf/versioning.py index 666f8eafc..c777b86bf 100644 --- a/asdf/versioning.py +++ b/asdf/versioning.py @@ -154,11 +154,11 @@ def __hash__(self): ] -default_version = AsdfVersion("1.5.0") +default_version = AsdfVersion("1.6.0") # This is the ASDF Standard version that is currently in development # it is possible that breaking changes will be made to this version. -asdf_standard_development_version = AsdfVersion("1.6.0") +asdf_standard_development_version = AsdfVersion("1.7.0") # This is the ASDF Standard version at which the format of the history diff --git a/docs/asdf/config.rst b/docs/asdf/config.rst index 9476c5466..dcdeb0861 100644 --- a/docs/asdf/config.rst +++ b/docs/asdf/config.rst @@ -40,7 +40,7 @@ the currently active config: all_array_compression: input all_array_compression_kwargs: None convert_unknown_ndarray_subclasses: True - default_version: 1.5.0 + default_version: 1.6.0 io_block_size: -1 legacy_fill_schema_defaults: True validate_on_read: True @@ -64,7 +64,7 @@ This allows for short-lived configuration changes that do not impact other code: all_array_compression: input all_array_compression_kwargs: None convert_unknown_ndarray_subclasses: True - default_version: 1.5.0 + default_version: 1.6.0 io_block_size: -1 legacy_fill_schema_defaults: True validate_on_read: False @@ -76,7 +76,7 @@ This allows for short-lived configuration changes that do not impact other code: all_array_compression: input all_array_compression_kwargs: None convert_unknown_ndarray_subclasses: True - default_version: 1.5.0 + default_version: 1.6.0 io_block_size: -1 legacy_fill_schema_defaults: True validate_on_read: True