Commit 44d1a1a8 authored by Torben Miny's avatar Torben Miny
Browse files

Merge branch compliance/Referable_missing_tests with refs/heads/master into...

Merge branch compliance/Referable_missing_tests with refs/heads/master into refs/merge-requests/68/train
parents ebba334f 3d622475
Pipeline #389288 passed with stage
in 1 minute and 15 seconds
...@@ -16,6 +16,7 @@ from typing import Optional, List ...@@ -16,6 +16,7 @@ from typing import Optional, List
from aas import model from aas import model
from aas.backend import backends from aas.backend import backends
from aas.model import Identifier, Identifiable from aas.model import Identifier, Identifiable
from aas.examples.data import example_aas
class KeyTest(unittest.TestCase): class KeyTest(unittest.TestCase):
...@@ -265,6 +266,30 @@ class ReferableTest(unittest.TestCase): ...@@ -265,6 +266,30 @@ class ReferableTest(unittest.TestCase):
relative_path=[]) relative_path=[])
]) ])
def test_update_from(self):
example_submodel = example_aas.create_example_submodel()
example_relel = example_submodel.get_referable('ExampleRelationshipElement')
other_submodel = example_aas.create_example_submodel()
other_relel = other_submodel.get_referable('ExampleRelationshipElement')
other_submodel.category = "NewCat"
other_relel.category = "NewRelElCat"
# Test basic functionality
example_submodel.update_from(other_submodel)
self.assertEqual("NewCat", example_submodel.category)
self.assertEqual("NewRelElCat", example_relel.category)
# Test source update
example_relel.source = "scheme:OldRelElSource"
other_submodel.source = "scheme:NewSource"
other_relel.source = "scheme:NewRelElSource"
example_submodel.update_from(other_submodel, update_source=True)
self.assertEqual("scheme:NewSource", example_submodel.source)
self.assertEqual("scheme:OldRelElSource", example_relel.source)
class ExampleNamespace(model.Namespace): class ExampleNamespace(model.Namespace):
def __init__(self, values=()): def __init__(self, values=()):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment