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) ------------------ 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: > diff --git a/tests/conftest.py b/tests/conftest.py index b315a252..b644c116 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -116,48 +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 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() - 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 = {} - 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 = {} @@ -170,7 +128,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 @@ -200,9 +158,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 294b8496..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: @@ -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..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) @@ -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())) @@ -47,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): """