|
@@ -3003,6 +3003,69 @@ class TestModelverse(unittest.TestCase):
|
|
|
group_delete("group2")
|
|
|
group_delete("group3")
|
|
|
|
|
|
+ def test_op_conformance_add(self):
|
|
|
+ # Add some conformance relations
|
|
|
+ model_add("users/user/test/a", "formalisms/SimpleClassDiagrams", """
|
|
|
+ Class A {}
|
|
|
+ Class B {}
|
|
|
+ Association C (A, B) {}
|
|
|
+ """)
|
|
|
+
|
|
|
+ # Add conformance bottom relation
|
|
|
+ t = model_types("users/user/test/a")
|
|
|
+ assert len(t) == 1
|
|
|
+ t = t.pop()
|
|
|
+ print(t)
|
|
|
+ assert t[0] == "formalisms/SimpleClassDiagrams"
|
|
|
+ assert t[1] != None
|
|
|
+ assert t[2] == None
|
|
|
+
|
|
|
+ # Check if the type is added, but without any type mapping associated to it
|
|
|
+ conformance_add("users/user/test/a", "formalisms/Bottom")
|
|
|
+ ts = model_types("users/user/test/a")
|
|
|
+ assert len(ts) == 2
|
|
|
+ while ts:
|
|
|
+ t = ts.pop()
|
|
|
+ assert t[0] in ["formalisms/SimpleClassDiagrams", "formalisms/Bottom"]
|
|
|
+ if t[0] == "formalisms/SimpleClassDiagrams":
|
|
|
+ assert t[1] != None
|
|
|
+ elif t[1] == "formalisms/Bottom":
|
|
|
+ # Type mapping is empty
|
|
|
+ assert t[1] == None
|
|
|
+ assert t[2] == None
|
|
|
+
|
|
|
+ # Check if a type mapping is created when model is opened as bottom
|
|
|
+ alter_context("users/user/test/a", "formalisms/Bottom")
|
|
|
+ element_list("users/user/test/a")
|
|
|
+ alter_context("users/user/test/a", "formalisms/SimpleClassDiagrams")
|
|
|
+
|
|
|
+ ts = model_types("users/user/test/a")
|
|
|
+ assert len(ts) == 2
|
|
|
+ while ts:
|
|
|
+ t = ts.pop()
|
|
|
+ assert t[0] in ["formalisms/SimpleClassDiagrams", "formalisms/Bottom"]
|
|
|
+ assert t[1] != None
|
|
|
+ assert t[2] == None
|
|
|
+
|
|
|
+ # Check if we can add a second one to the same MM
|
|
|
+ conformance_add("users/user/test/a", "formalisms/Bottom")
|
|
|
+ ts = model_types("users/user/test/a")
|
|
|
+ print("Got types: " + str(ts))
|
|
|
+ assert len(ts) == 3
|
|
|
+ assert ("formalisms/Bottom", None, None) in ts
|
|
|
+ found = False
|
|
|
+ while ts:
|
|
|
+ t = ts.pop()
|
|
|
+ assert t[0] in ["formalisms/SimpleClassDiagrams", "formalisms/Bottom"]
|
|
|
+ if t[0] == "formalisms/SimpleClassDiagrams":
|
|
|
+ assert t[1] != None
|
|
|
+ elif t[0] == "formalisms/Bottom":
|
|
|
+ # Type mapping is empty
|
|
|
+ if t[1] != None:
|
|
|
+ found = True
|
|
|
+ assert t[2] == None
|
|
|
+ assert found
|
|
|
+
|
|
|
"""
|
|
|
def test_op_model_render(self):
|
|
|
def test_op_transformation_between(self):
|