From 0bcd7080344798c48dcb48777e74d28b932f1e5c Mon Sep 17 00:00:00 2001 From: jwfraustro <36318163+jwfraustro@users.noreply.github.com> Date: Thu, 26 Sep 2024 19:04:03 -0400 Subject: [PATCH] finally good hopefully --- tests/tapregext/tapregext_models_test.py | 1 - tests/voresource/voresource_models_test.py | 38 +++++++++++----------- tests/vosi/capabilities_test.py | 2 +- vo_models/tapregext/models.py | 5 +-- vo_models/voresource/models.py | 2 +- vo_models/vosi/capabilities/models.py | 2 -- 6 files changed, 24 insertions(+), 26 deletions(-) diff --git a/tests/tapregext/tapregext_models_test.py b/tests/tapregext/tapregext_models_test.py index 2b358a5..d3f10a4 100644 --- a/tests/tapregext/tapregext_models_test.py +++ b/tests/tapregext/tapregext_models_test.py @@ -21,7 +21,6 @@ TAPREGEXT_NAMESPACE_HEADER = """xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vm="http://www.ivoa.net/xml/VOMetadata/v0.1" -xmlns="http://www.ivoa.net/xml/TAPRegExt/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" """ diff --git a/tests/voresource/voresource_models_test.py b/tests/voresource/voresource_models_test.py index 53b6c64..edd10ad 100644 --- a/tests/voresource/voresource_models_test.py +++ b/tests/voresource/voresource_models_test.py @@ -43,7 +43,7 @@ class TestValidation(TestCase): test_validation_model = Validation(value=0, validated_by="https://example.edu") test_validation_xml = ( - '0' + '0' ) def test_read_from_xml(self): @@ -65,7 +65,7 @@ class TestResourceName(TestCase): """Test VOResource ResourceName model.""" test_resource_name_model = ResourceName(value="Example Resource", ivo_id="ivo://example.edu/resource") - test_resource_name_xml = 'Example Resource' + test_resource_name_xml = 'Example Resource' def test_read_from_xml(self): """Test reading from XML.""" @@ -87,7 +87,7 @@ class TestDate(TestCase): test_date_model = Date(value="2021-01-01T00:00:00Z", role="update") test_date_xml = ( - '2021-01-01T00:00:00.000Z' + '2021-01-01T00:00:00.000Z' ) def test_read_from_xml(self): @@ -110,7 +110,7 @@ class TestSource(TestCase): test_source_model = Source(value="https://example.edu", format="bibcode") test_source_xml = ( - 'https://example.edu/' + 'https://example.edu/' ) def test_read_from_xml(self): @@ -132,7 +132,7 @@ class TestRights(TestCase): """Test VOResource Rights model""" test_rights_model = Rights(value="CC BY 4.0", rights_uri="https://creativecommons.org/licenses/by/4.0/") - test_rights_xml = 'CC BY 4.0' + test_rights_xml = 'CC BY 4.0' def test_read_from_xml(self): """Test reading from XML.""" @@ -154,7 +154,7 @@ class TestAccessURL(TestCase): test_access_url_model = AccessURL(value="https://example.edu", use="full") test_access_url_xml = ( - 'https://example.edu/' + 'https://example.edu/' ) def test_read_from_xml(self): @@ -177,7 +177,7 @@ class TestMirrorURL(TestCase): test_mirror_url_model = MirrorURL(value="https://example.edu", title="Mirror") test_mirror_url_xml = ( - 'https://example.edu/' + 'https://example.edu/' ) def test_read_from_xml(self): @@ -206,7 +206,7 @@ class TestContact(TestCase): alt_identifier=["http://orcid.org/0000-0001-9718-6515"], ) test_contact_xml = ( - '' + '' "John Doe" "
1234 Example St.
" "jdoe@mail.com" @@ -238,7 +238,7 @@ class TestCreator(TestCase): test_creator_model = Creator(name=ResourceName(value="Doe, J."), logo="https://example.edu/logo.png") test_creator_xml = ( - '' + '' "Doe, J." "https://example.edu/logo.png" "" @@ -267,7 +267,7 @@ class TestRelationship(TestCase): related_resource=[ResourceName(value="Example Resource", ivo_id="ivo://example.edu/resource")], ) test_relationship_xml = ( - '' + '' "isPartOf" 'Example Resource' "" @@ -293,7 +293,7 @@ class TestSecurityMethod(TestCase): """Test VOResource SecurityMethod model""" test_security_method_model = SecurityMethod(standard_id="ivo://ivoa.net/std/Security#basic") - test_security_method_xml = '' + test_security_method_xml = '' def test_read_from_xml(self): """Test reading from XML.""" @@ -322,7 +322,7 @@ class TestCuration(TestCase): ) test_curation_xml = ( - '' + '' "STScI" "Doe, J." "Example Resource" @@ -371,7 +371,7 @@ class TestContent(TestCase): ) test_content_xml = ( - '' + '' "Astronomy" "Example description" 'https://example.edu/' @@ -420,7 +420,7 @@ class TestInterface(TestCase): test_querystring="test", ) test_interface_xml = ( - '' + '' 'https://example.edu/' 'https://example.edu/' '' @@ -457,7 +457,7 @@ class TestWebService(TestCase): access_url=[AccessURL(value="https://example.edu/", use="full")], ) test_web_service_xml = ( - '' 'https://example.edu/' @@ -520,7 +520,7 @@ class TestResource(TestCase): ) test_resource_xml = ( - '' + '' '0' "Example Resource" "example" @@ -612,7 +612,7 @@ class TestOrganization(TestCase): ) test_organization_xml = ( - '' + '' "Example Organization" "https://example.edu/" "" @@ -670,7 +670,7 @@ class TestCapability(TestCase): ) test_capability_xml = ( - '' + '' '0' "Example description" '' @@ -734,7 +734,7 @@ class TestService(TestCase): ) test_service_xml = ( - '' + '' "Example Service" "https://example.edu/" "" diff --git a/tests/vosi/capabilities_test.py b/tests/vosi/capabilities_test.py index 94ad6b4..7ecee09 100644 --- a/tests/vosi/capabilities_test.py +++ b/tests/vosi/capabilities_test.py @@ -19,8 +19,8 @@ from vo_models.vosi.capabilities.models import VOSICapabilities CAPABILITIES_HEADER = """xmlns:vosi="http://www.ivoa.net/xml/VOSICapabilities/v1.0" -xmlns="http://www.ivoa.net/xml/VOResource/v1.0" xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.0" +xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0" xmlns:tr="http://www.ivoa.net/xml/TAPRegExt/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" """ diff --git a/vo_models/tapregext/models.py b/vo_models/tapregext/models.py index b518247..296abb5 100644 --- a/vo_models/tapregext/models.py +++ b/vo_models/tapregext/models.py @@ -5,13 +5,14 @@ from pydantic_xml import BaseXmlModel, attr, element from vo_models.voresource.models import Capability +from vo_models.voresource.models import NSMAP as VORESOURCE_NSMAP NSMAP = { "xs": "http://www.w3.org/2001/XMLSchema", "vm": "http://www.ivoa.net/xml/VOMetadata/v0.1", - "": "http://www.ivoa.net/xml/TAPRegExt/v1.0", + "tr": "http://www.ivoa.net/xml/TAPRegExt/v1.0", "xsi": "http://www.w3.org/2001/XMLSchema-instance", -} +} | VORESOURCE_NSMAP class DataModelType(BaseXmlModel, nsmap=NSMAP): diff --git a/vo_models/voresource/models.py b/vo_models/voresource/models.py index 6abf80d..722588b 100644 --- a/vo_models/voresource/models.py +++ b/vo_models/voresource/models.py @@ -11,7 +11,7 @@ # pylint: disable=too-few-public-methods NSMAP = { - "": "http://www.ivoa.net/xml/VOResource/v1.0", + "vr": "http://www.ivoa.net/xml/VOResource/v1.0", "xs": "http://www.w3.org/2001/XMLSchema", "vm": "http://www.ivoa.net/xml/VOMetadata/v0.1", "xsi": "http://www.w3.org/2001/XMLSchema-instance", diff --git a/vo_models/vosi/capabilities/models.py b/vo_models/vosi/capabilities/models.py index 608f8aa..e3447af 100644 --- a/vo_models/vosi/capabilities/models.py +++ b/vo_models/vosi/capabilities/models.py @@ -12,7 +12,6 @@ "vosi": "http://www.ivoa.net/xml/VOSICapabilities/v1.0", "xsd": "http://www.w3.org/2001/XMLSchema", "xsi": "http://www.w3.org/2001/XMLSchema-instance", - "tr": "http://www.ivoa.net/xml/TAPRegExt/v1.0", } | VORESOURCE_NSMAP @@ -29,6 +28,5 @@ class VOSICapabilities(BaseXmlModel, tag="capabilities", ns="vosi", nsmap=NSMAP) capability: list[Union[TableAccess, Capability]] = element( tag="capability", ns="", - nsmap=NSMAP, default=[], )