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 Jan 6, 2025
1 parent a287576 commit f0c7eb1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sdk/basyx/aas/examples/data/_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ def _check_has_semantics_equal(self, object_: model.HasSemantics, expected_objec
:return: The value of expression to be used in control statements
"""
self.check_attribute_equal(object_, "semantic_id", expected_object.semantic_id)
if isinstance(expected_object.semantic_id, model.ModelReference) and 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 f0c7eb1

Please sign in to comment.