Skip to content

Commit f0c7eb1

Browse files
committed
aas.adapter: check semantic ids have same model reference type
1 parent a287576 commit f0c7eb1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sdk/basyx/aas/examples/data/_helper.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,18 @@ def _check_has_semantics_equal(self, object_: model.HasSemantics, expected_objec
213213
:return: The value of expression to be used in control statements
214214
"""
215215
self.check_attribute_equal(object_, "semantic_id", expected_object.semantic_id)
216+
if isinstance(expected_object.semantic_id, model.ModelReference) and self.check(
217+
isinstance(object_.semantic_id, model.ModelReference),
218+
"{} must be a ModelReference".format(repr(object_)),
219+
): # type: ignore
220+
self.check(
221+
object_.semantic_id.type == expected_object.semantic_id.type, # type: ignore
222+
"ModelReference type {} of {} must be equal to {}".format(
223+
object_.semantic_id.type, # type: ignore
224+
repr(object_),
225+
expected_object.semantic_id.type,
226+
),
227+
)
216228
for suppl_semantic_id in expected_object.supplemental_semantic_id:
217229
given_semantic_id = self._find_reference(suppl_semantic_id, object_.supplemental_semantic_id)
218230
self.check(given_semantic_id is not None, f"{object_!r} must have supplementalSemanticId",

0 commit comments

Comments
 (0)