Skip to content

Commit

Permalink
aas.adapter: check semantic ids have same model reference type
Browse files Browse the repository at this point in the history
  • Loading branch information
JGrothoff committed Nov 21, 2024
1 parent 9f0dea6 commit 381d6a9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sdk/basyx/aas/examples/data/_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,15 @@ def _check_has_semantics_equal(self, object_: model.HasSemantics, expected_objec
:param expected_object: The expected HasSemantic object
:return: The value of expression to be used in control statements
"""
self.check_attribute_equal(object_, "semantic_id", expected_object.semantic_id)
if self.check_attribute_equal(object_, "semantic_id", expected_object.semantic_id) and \
isinstance(expected_object.semantic_id, model.ModelReference):
if self.check(isinstance(object_.semantic_id, model.ModelReference),
'{} must be a ModelReference'.format(repr(object_))): # type: ignore
self.check(
object_.semantic_id.type == expected_object.semantic_id.type, # type: ignore
'ModelReference type {} of {} must be equal to {}'.format(object_.semantic_id.type, # type: ignore
repr(object_),
expected_object.semantic_id.type))
for suppl_semantic_id in expected_object.supplemental_semantic_id:
given_semantic_id = self._find_reference(suppl_semantic_id, object_.supplemental_semantic_id)
self.check(given_semantic_id is not None, f"{object_!r} must have supplementalSemanticId",
Expand Down

0 comments on commit 381d6a9

Please sign in to comment.