From 62b4fd40ba211fbfb5c8004234d277ee8f89ddcf Mon Sep 17 00:00:00 2001 From: Brian Pepple Date: Sun, 27 Apr 2025 16:31:09 -0400 Subject: [PATCH] Remove unnecessary type definition `genreType` It's the same as `resourceType`, so no reason to keep it. Add tests for v1.1 xsd. --- drafts/v1.1/MetronInfo.xsd | 10 +--------- tests/test.py | 41 +++++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/drafts/v1.1/MetronInfo.xsd b/drafts/v1.1/MetronInfo.xsd index 38725bc..45fcead 100644 --- a/drafts/v1.1/MetronInfo.xsd +++ b/drafts/v1.1/MetronInfo.xsd @@ -204,17 +204,9 @@ - - - - - - - - - + diff --git a/tests/test.py b/tests/test.py index a3fd56a..f576ae0 100644 --- a/tests/test.py +++ b/tests/test.py @@ -3,26 +3,38 @@ import pytest from xmlschema import XMLSchema11, XMLSchemaValidationError -TEST_XSD = Path(__file__).parent.parent / "schema" / "v1.0" / "MetronInfo.xsd" +TEST_V10_XSD = Path(__file__).parent.parent / "schema" / "v1.0" / "MetronInfo.xsd" +TEST_V11_XSD = Path(__file__).parent.parent / "drafts" / "v1.1" / "MetronInfo.xsd" TEST_FILES_PATH = Path(__file__).parent / "test_files" / "v1.0" @pytest.mark.parametrize( ("xsd", "xml"), [ - (TEST_XSD, TEST_FILES_PATH / "valid.xml"), + (TEST_V10_XSD, TEST_FILES_PATH / "valid.xml"), ( - TEST_XSD, + TEST_V10_XSD, '' "Foo0", ), ( - TEST_XSD, + TEST_V10_XSD, '' "Foo0", ), + (TEST_V11_XSD, TEST_FILES_PATH / "valid.xml"), + ( + TEST_V10_XSD, + '' + "Foo0", + ), + ( + TEST_V10_XSD, + '' + "Foo0", + ), ], - ids=["valid_xml", "zero_page_count", "volume_zero"], + ids=["valid_xml", "zero_page_count", "volume_zero", "v11_valid_xml", "v11_zero_page_count", "v11_volume_zero"], ) def test_valid(xsd: Path, xml: Path | str) -> None: schema = XMLSchema11(xsd) @@ -32,19 +44,30 @@ def test_valid(xsd: Path, xml: Path | str) -> None: @pytest.mark.parametrize( ("xsd", "xml"), [ - (TEST_XSD, TEST_FILES_PATH / "dup_primary_attr.xml"), + (TEST_V10_XSD, TEST_FILES_PATH / "dup_primary_attr.xml"), ( - TEST_XSD, + TEST_V10_XSD, '' "Foo-1", ), ( - TEST_XSD, + TEST_V10_XSD, '' "Foo-1", ), + (TEST_V11_XSD, TEST_FILES_PATH / "dup_primary_attr.xml"), + ( + TEST_V11_XSD, + '' + "Foo-1", + ), + ( + TEST_V11_XSD, + '' + "Foo-1", + ), ], - ids=["dup_primary_attr_xml", "negative_page_count", "negative_volume"], + ids=["dup_primary_attr_xml", "negative_page_count", "negative_volume", "v11_dup_primary_attr_xml", "v11_negative_page_count", "v11_negative_volume" ], ) def test_invalid(xsd: Path, xml: Path | str) -> None: schema = XMLSchema11(xsd)