From 71a389bcfe352425140097419e18c7c07988626d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20M=C3=B6ller?= Date: Thu, 7 Mar 2024 23:34:14 +0100 Subject: [PATCH] test_base: add test for non-numeric `SubmodelElementList` Key values A duplicate test is replaced by this test. --- test/model/test_base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/model/test_base.py b/test/model/test_base.py index 2bc5195c4..21ae1f13d 100644 --- a/test/model/test_base.py +++ b/test/model/test_base.py @@ -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)