Skip to content

Commit 381d6a9

Browse files
committed
aas.adapter: check semantic ids have same model reference type
1 parent 9f0dea6 commit 381d6a9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,15 @@ def _check_has_semantics_equal(self, object_: model.HasSemantics, expected_objec
212212
:param expected_object: The expected HasSemantic object
213213
:return: The value of expression to be used in control statements
214214
"""
215-
self.check_attribute_equal(object_, "semantic_id", expected_object.semantic_id)
215+
if self.check_attribute_equal(object_, "semantic_id", expected_object.semantic_id) and \
216+
isinstance(expected_object.semantic_id, model.ModelReference):
217+
if self.check(isinstance(object_.semantic_id, model.ModelReference),
218+
'{} must be a ModelReference'.format(repr(object_))): # type: ignore
219+
self.check(
220+
object_.semantic_id.type == expected_object.semantic_id.type, # type: ignore
221+
'ModelReference type {} of {} must be equal to {}'.format(object_.semantic_id.type, # type: ignore
222+
repr(object_),
223+
expected_object.semantic_id.type))
216224
for suppl_semantic_id in expected_object.supplemental_semantic_id:
217225
given_semantic_id = self._find_reference(suppl_semantic_id, object_.supplemental_semantic_id)
218226
self.check(given_semantic_id is not None, f"{object_!r} must have supplementalSemanticId",

0 commit comments

Comments
 (0)