Skip to content

Commit

Permalink
test_base: add test for non-numeric SubmodelElementList Key values
Browse files Browse the repository at this point in the history
A duplicate test is replaced by this test.
  • Loading branch information
jkhsjdhjs authored and s-heppner committed Mar 14, 2024
1 parent b008187 commit 71a389b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/model/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,15 @@ def get_identifiable(self, identifier: Identifier) -> Identifiable:
self.assertEqual("'Referable with id_short prop_false not found in "
"SubmodelElementCollection[urn:x-test:submodel / list[0]]'", str(cm_8.exception))

ref9 = model.ModelReference((model.Key(model.KeyTypes.SUBMODEL, "urn:x-test:submodel"),
model.Key(model.KeyTypes.SUBMODEL_ELEMENT_COLLECTION, "list"),
model.Key(model.KeyTypes.SUBMODEL_ELEMENT_COLLECTION, "collection")),
model.SubmodelElementCollection)

with self.assertRaises(ValueError) as cm_9:
ref9 = model.ModelReference((), model.Submodel)
self.assertEqual('A reference must have at least one key!', str(cm_9.exception))
ref9.resolve(DummyObjectProvider())
self.assertEqual("Cannot resolve 'collection' at SubmodelElementList[urn:x-test:submodel / list], "
"because it is not a numeric index!", str(cm_9.exception))

def test_get_identifier(self) -> None:
ref = model.ModelReference((model.Key(model.KeyTypes.SUBMODEL, "urn:x-test:x"),), model.Submodel)
Expand Down

0 comments on commit 71a389b

Please sign in to comment.