Skip to content

Commit de82662

Browse files
authored
Merge the bugfixes from branch main into improve/V30
2 parents 0f55c2a + 6d58ca7 commit de82662

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

basyx/aas/adapter/xml/xml_deserialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _tag_replace_namespace(tag: str, nsmap: Dict[str, str]) -> str:
8787
"""
8888
split = tag.split("}")
8989
for prefix, namespace in nsmap.items():
90-
if namespace == split[0][1:]:
90+
if prefix and namespace == split[0][1:]:
9191
return prefix + ":" + split[1]
9292
return tag
9393

test/adapter/xml/test_xml_deserialization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def test_operation_variable_no_submodel_element(self) -> None:
221221
</aas:submodel>
222222
</aas:submodels>
223223
""")
224-
self._assertInExceptionAndLog(xml, "aas:value", KeyError, logging.ERROR)
224+
self._assertInExceptionAndLog(xml, ["aas:value", "has no submodel element"], KeyError, logging.ERROR)
225225

226226
def test_operation_variable_too_many_submodel_elements(self) -> None:
227227
# TODO: simplify this should our suggestion regarding the XML schema get accepted
@@ -256,6 +256,7 @@ def test_operation_variable_too_many_submodel_elements(self) -> None:
256256
with self.assertLogs(logging.getLogger(), level=logging.WARNING) as context:
257257
read_aas_xml_file(io.BytesIO(xml.encode("utf-8")), failsafe=False)
258258
self.assertIn("aas:value", context.output[0]) # type: ignore
259+
self.assertIn("more than one submodel element", context.output[0])
259260

260261
def test_duplicate_identifier(self) -> None:
261262
xml = _xml_wrap("""
@@ -306,7 +307,7 @@ def get_clean_store() -> model.DictObjectStore:
306307
with self.assertLogs(logging.getLogger(), level=logging.INFO) as log_ctx:
307308
identifiers = read_aas_xml_file_into(object_store, bytes_io, replace_existing=False, ignore_existing=True)
308309
self.assertEqual(len(identifiers), 0)
309-
self.assertIn("already exists in the object store", log_ctx.output[0]) # type: ignore
310+
self.assertIn("already exists in the object store", log_ctx.output[0])
310311
submodel = object_store.pop()
311312
self.assertIsInstance(submodel, model.Submodel)
312313
self.assertEqual(submodel.id_short, "test123")

0 commit comments

Comments
 (0)