Skip to content

Commit

Permalink
test.adapter.xml: test deserialization without namespace prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkhsjdhjs committed Mar 13, 2024
1 parent 776bbda commit cbad128
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/adapter/xml/test_xml_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,22 @@ def test_read_aas_xml_element(self) -> None:
submodel = read_aas_xml_element(bytes_io, XMLConstructables.SUBMODEL)
self.assertIsInstance(submodel, model.Submodel)

def test_no_namespace_prefix(self) -> None:
def xml(id_: str) -> str:
return f"""
<environment xmlns="{XML_NS_MAP["aas"]}">
<submodels>
<submodel>
<id>{id_}</id>
</submodel>
</submodels>
</environment>
"""

self._assertInExceptionAndLog(xml(""), f'{{{XML_NS_MAP["aas"]}}}id on line 5 has no text', KeyError,
logging.ERROR)
read_aas_xml_file(io.StringIO(xml("urn:x-test:test-submodel")))


class XmlDeserializationStrippedObjectsTest(unittest.TestCase):
def test_stripped_qualifiable(self) -> None:
Expand Down

0 comments on commit cbad128

Please sign in to comment.