From 735ff17d92a45d86c1fef316dfb851ab7a5bc773 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 7 Feb 2024 12:38:46 -0500 Subject: [PATCH 1/7] remove unused tag from fits schemas --- resources/schemas/stsci.edu/asdf/fits/fits-1.0.0.yaml | 1 - resources/schemas/stsci.edu/asdf/fits/fits-1.1.0.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/resources/schemas/stsci.edu/asdf/fits/fits-1.0.0.yaml b/resources/schemas/stsci.edu/asdf/fits/fits-1.0.0.yaml index ac13fa72..de0ace11 100644 --- a/resources/schemas/stsci.edu/asdf/fits/fits-1.0.0.yaml +++ b/resources/schemas/stsci.edu/asdf/fits/fits-1.0.0.yaml @@ -72,7 +72,6 @@ examples: - [EXTNAME, ERR, extension name] - [BUNIT, DN, Units of the error array] -tag: "tag:stsci.edu:asdf/fits/fits-1.0.0" type: array items: description: > diff --git a/resources/schemas/stsci.edu/asdf/fits/fits-1.1.0.yaml b/resources/schemas/stsci.edu/asdf/fits/fits-1.1.0.yaml index 9c17a89f..15407224 100644 --- a/resources/schemas/stsci.edu/asdf/fits/fits-1.1.0.yaml +++ b/resources/schemas/stsci.edu/asdf/fits/fits-1.1.0.yaml @@ -73,7 +73,6 @@ examples: - [EXTNAME, ERR, extension name] - [BUNIT, DN, Units of the error array] -tag: "tag:stsci.edu:asdf/fits/fits-1.1.0" type: array items: description: > From e476f75616a0410b397e9da17d472c2137413a37 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 7 Feb 2024 12:42:54 -0500 Subject: [PATCH 2/7] remove tag checks from tests --- tests/test_manifests.py | 9 --------- tests/test_version_map.py | 5 ----- 2 files changed, 14 deletions(-) diff --git a/tests/test_manifests.py b/tests/test_manifests.py index 294b8496..1226b5b0 100644 --- a/tests/test_manifests.py +++ b/tests/test_manifests.py @@ -21,14 +21,5 @@ def test_manifest(path, tag_to_schema): assert "description" in manifest for tag in manifest["tags"]: - if ( - "time" not in tag["tag_uri"] - and "core" not in tag["tag_uri"] - and "unit" not in tag["tag_uri"] - and "wcs" not in tag["tag_uri"] - ): - assert tag["tag_uri"] in tag_to_schema - schema = tag_to_schema[tag["tag_uri"]][0] - assert tag["schema_uri"] == schema["id"] assert "title" in tag assert "description" in tag diff --git a/tests/test_version_map.py b/tests/test_version_map.py index af6f55c0..0223df4f 100644 --- a/tests/test_version_map.py +++ b/tests/test_version_map.py @@ -33,11 +33,6 @@ def test_version_map(path, schema_tags): assert vm["FILE_FORMAT"] in VALID_FILE_FORMAT_VERSIONS assert vm["YAML_VERSION"] in VALID_YAML_VERSIONS - for tag_base, tag_version in vm["tags"].items(): - tag = f"{tag_base}-{tag_version}" - if "time" not in tag and "core" not in tag and "unit" not in tag and "wcs" not in tag: - assert tag in schema_tags, f"{path.name} specifies missing tag {tag}" - assert len(vm["tags"].keys()) == len(set(vm["tags"].keys())), f"{path.name} contains duplicate tags" sorted_tags = sorted(list(vm["tags"].keys())) From 1665d4b8ade417210e06088201338b308ae02c3e Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 7 Feb 2024 12:52:16 -0500 Subject: [PATCH 3/7] remove empty latest_schema_tags fixture and empty test_latest_version_map --- tests/conftest.py | 10 ---------- tests/test_version_map.py | 36 ------------------------------------ 2 files changed, 46 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b315a252..e2899427 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -126,16 +126,6 @@ def _get_tag(schema): return None -@pytest.fixture(scope="session") -def latest_schema_tags(latest_schemas): - result = set() - for schema in latest_schemas: - tag = _get_tag(schema) - if tag is not None: - result.add(tag) - return result - - @pytest.fixture(scope="session") def schema_tags(schemas): result = set() diff --git a/tests/test_version_map.py b/tests/test_version_map.py index 0223df4f..d28544fa 100644 --- a/tests/test_version_map.py +++ b/tests/test_version_map.py @@ -42,42 +42,6 @@ def test_version_map(path, schema_tags): assert False, message -def test_latest_version_map(latest_schema_tags): - """ - The current latest version map has some special requirements. - """ - vm = load_yaml(LATEST_PATH) - - tag_base_to_version = dict([tag.rsplit("-", 1) for tag in latest_schema_tags]) - - expected_tag_bases = {t for t in tag_base_to_version.keys() if not is_deprecated(t)} - vm_tag_bases = set(vm["tags"].keys()) - if not expected_tag_bases.issubset(vm_tag_bases): - missing_tag_bases = expected_tag_bases - vm_tag_bases - insert_list = "\n".join( - sorted(f"""{tag_base}-{tag_base_to_version[tag_base]}""" for tag_base in missing_tag_bases) - ) - message = ( - f"{LATEST_PATH.name} must include the latest version of " - "every non-deprecated schema with a tag. Update the deprecation " - "list in tests/common.py, or add the following missing schemas: \n" - f"{insert_list}" - ) - assert False, message - - incorrect_tag_bases = sorted(tag for tag in expected_tag_bases if vm["tags"][tag] != tag_base_to_version[tag]) - if len(incorrect_tag_bases) > 0: - update_list = "\n".join( - [f"""{tag}: {vm["tags"][tag]} --> {tag_base_to_version[tag]}""" for tag in incorrect_tag_bases] - ) - message = ( - f"{LATEST_PATH.name} must include the latest version of " - "every non-deprecated schema with a tag. Update the following: \n" - f"{update_list}" - ) - assert False, message - - @pytest.mark.parametrize("path, previous_path", zip(SORTED_PATHS[1:], SORTED_PATHS[0:-1])) def test_version_map_tags_retained(path, previous_path): """ From 9375e9af06c5a6c53506407f23a3638d9b3215c9 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 7 Feb 2024 12:53:40 -0500 Subject: [PATCH 4/7] remove unused schema_tags fixture --- tests/conftest.py | 10 ---------- tests/test_version_map.py | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index e2899427..ad01645b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -126,16 +126,6 @@ def _get_tag(schema): return None -@pytest.fixture(scope="session") -def schema_tags(schemas): - result = set() - for schema in schemas: - tag = _get_tag(schema) - if tag is not None: - result.add(tag) - return result - - @pytest.fixture(scope="session") def tag_to_schema(schemas): result = {} diff --git a/tests/test_version_map.py b/tests/test_version_map.py index d28544fa..47671738 100644 --- a/tests/test_version_map.py +++ b/tests/test_version_map.py @@ -21,7 +21,7 @@ @pytest.mark.parametrize("path", VERSION_MAP_PATHS) -def test_version_map(path, schema_tags): +def test_version_map(path): assert VALID_FILENAME_RE.match(path.name) is not None, f"{path.name} is an invalid version map filename" assert_yaml_header_and_footer(path) From 62557a1fa35436e5fa4ac99511657bd62c04ce3a Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 7 Feb 2024 12:55:16 -0500 Subject: [PATCH 5/7] remove unused latest_schema_tags --- tests/conftest.py | 17 +---------------- tests/test_manifests.py | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ad01645b..0ad58b9d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -126,18 +126,6 @@ def _get_tag(schema): return None -@pytest.fixture(scope="session") -def tag_to_schema(schemas): - result = {} - for schema in schemas: - tag = _get_tag(schema) - if tag is not None: - if tag not in result: - result[tag] = [] - result[tag].append(schema) - return result - - @pytest.fixture(scope="session") def id_to_schema(schemas): result = {} @@ -150,7 +138,7 @@ def id_to_schema(schemas): @pytest.fixture(scope="session") -def assert_schema_correct(tag_to_schema, id_to_schema): +def assert_schema_correct(id_to_schema): def _assert_schema_correct(path): __tracebackhide__ = True @@ -180,9 +168,6 @@ def _assert_schema_correct(path): assert len(id_to_schema[schema["id"]]) == 1, f"{path.name} does not have a unique id" - if "tag" in schema: - assert len(tag_to_schema[schema["tag"]]) == 1, f"{path.name} does not have a unique tag" - id_base, _ = split_id(schema["id"]) for example_id in list_example_ids(schema): example_id_base, _ = split_id(example_id) diff --git a/tests/test_manifests.py b/tests/test_manifests.py index 1226b5b0..eca08b62 100644 --- a/tests/test_manifests.py +++ b/tests/test_manifests.py @@ -8,7 +8,7 @@ @pytest.mark.parametrize("path", MANIFEST_PATHS) -def test_manifest(path, tag_to_schema): +def test_manifest(path): manifest = load_yaml(path) with asdf.config_context() as config: From 87c9baac65cba8d0d785cb21987621d1039ab26c Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 7 Feb 2024 12:56:17 -0500 Subject: [PATCH 6/7] remove unused _get_tag --- tests/conftest.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0ad58b9d..b644c116 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -116,16 +116,6 @@ def docs_manifest_ids(): return result -def _get_tag(schema): - if "tag" in schema: - return schema["tag"] - elif "anyOf" in schema: - for elem in schema["anyOf"]: - if "tag" in elem: - return elem["tag"] - return None - - @pytest.fixture(scope="session") def id_to_schema(schemas): result = {} From 4f5cd79a92828001d02229a6248d283172fb4c09 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 8 Feb 2024 16:03:44 -0500 Subject: [PATCH 7/7] add changelog --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 1d450906..71922f34 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,7 @@ The stable ASDF Standard is v1.5.0 - Fix URI fragment format in quantity-1.2 schema [#374] - Drop support for python 3.8 [#390] - Add ``float16`` to ``ndarray-1.1.0`` [#411] +- Remove unneeded ``tag`` keyword from ``fits`` schema [#421] 1.0.3 (2022-08-08) ------------------