Commit 56491e8b authored by Michael Thies's avatar Michael Thies
Browse files

Merge branch 'fix/deserialization_return_types' into 'master'

adapter: specify type of objects in DictObjectStore for xml/json deserialize functions

See merge request acplt/pyaas!26
parents 3bc00aed 7a0a5f9e
Pipeline #270198 passed with stage
in 2 minutes and 56 seconds
......@@ -675,7 +675,7 @@ class StrictAASFromJsonDecoder(AASFromJsonDecoder):
failsafe = False
def read_aas_json_file(file: IO, failsafe: bool = True) -> model.DictObjectStore:
def read_aas_json_file(file: IO, failsafe: bool = True) -> model.DictObjectStore[model.Identifiable]:
"""
Read an Asset Adminstration Shell JSON file according to 'Details of the Asset Administration Shell', chapter 5.5
......
......@@ -966,7 +966,7 @@ def _construct_concept_description(element: etree.Element, failsafe: bool, **_kw
return cd
def read_aas_xml_file(file: IO, failsafe: bool = True) -> model.DictObjectStore:
def read_aas_xml_file(file: IO, failsafe: bool = True) -> model.DictObjectStore[model.Identifiable]:
"""
Read an Asset Administration Shell XML file according to 'Details of the Asset Administration Shell', chapter 5.4
......
......@@ -166,6 +166,7 @@ class XMLDeserializationTest(unittest.TestCase):
# modeling kind should default to INSTANCE
submodel = object_store.pop()
self.assertIsInstance(submodel, model.Submodel)
assert(isinstance(submodel, model.Submodel)) # to make mypy happy
self.assertEqual(submodel.kind, model.ModelingKind.INSTANCE)
def test_reference_kind_mismatch(self) -> None:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment