def test_get_default_resolver(): resolver = extension.get_default_resolver() result = resolver('tag:stsci.edu:asdf/core/ndarray-1.0.0') assert result.endswith( "asdf-standard/schemas/stsci.edu/asdf/core/ndarray-1.0.0.yaml")
def test_schema_resolved_via_entry_points(): """Test that entry points mappings to core schema works""" r = extension.get_default_resolver() tag = types.format_tag('stsci.edu', 'asdf', '1.0.0', 'fits/fits') url = extension.default_extensions.extension_list.tag_mapping(tag) s = schema.load_schema(url, resolver=r, resolve_references=True) assert tag in repr(s)
def test_load_schema_with_file_url(tmpdir): schema_def = """ %YAML 1.1 %TAG !asdf! tag:stsci.edu:asdf/ --- $schema: "http://stsci.edu/schemas/asdf/asdf-schema-1.0.0" id: "http://stsci.edu/schemas/asdf/nugatory/nugatory-1.0.0" tag: "tag:stsci.edu:asdf/nugatory/nugatory-1.0.0" type: object properties: foobar: $ref: "{}" required: [foobar] ... """.format(extension.get_default_resolver()( 'tag:stsci.edu:asdf/core/ndarray-1.0.0')) schema_path = tmpdir.join('nugatory.yaml') schema_path.write(schema_def.encode()) schema_tree = schema.load_schema(str(schema_path), resolve_references=True) schema.check_schema(schema_tree)