|
@@ -383,29 +383,29 @@ class TestModelverse(unittest.TestCase):
|
|
|
|
|
|
got = element_list_nice("test/PetriNet")
|
|
|
expected = \
|
|
|
- [{'id': 'Natural', 'type': 'SimpleAttribute', 'constraint': {'AL': ''}, 'name': 'Natural'},
|
|
|
- {'id': 'String', 'type': 'SimpleAttribute', 'constraint': {'AL': ''}, 'name': 'String'},
|
|
|
- {'id': 'Place', 'type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'Place'},
|
|
|
- {'id': 'Place_tokens', 'type': 'AttributeLink', '__source': 'Place', '__target': 'Natural', 'name': 'tokens', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
- {'id': 'Place_name', 'type': 'AttributeLink', '__source': 'Place', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
- {'id': 'Transition', 'type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'Transition'},
|
|
|
- {'id': 'Transition_name', 'type': 'AttributeLink', '__source': 'Transition', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
- {'id': 'P2T', 'type': 'Association', '__source': 'Place', '__target': 'Transition', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'P2T'},
|
|
|
- {'id': 'P2T_weight', 'type': 'AttributeLink', '__source': 'P2T', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
- {'id': 'T2P', 'type': 'Association', '__source': 'Transition', '__target': 'Place', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'T2P'},
|
|
|
- {'id': 'T2P_weight', 'type': 'AttributeLink', '__source': 'T2P', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': {'AL': ''}}
|
|
|
+ [{'__id': 'Natural', '__type': 'SimpleAttribute', 'constraint': {'AL': ''}, 'name': 'Natural'},
|
|
|
+ {'__id': 'String', '__type': 'SimpleAttribute', 'constraint': {'AL': ''}, 'name': 'String'},
|
|
|
+ {'__id': 'Place', '__type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'Place', 'abstract': None},
|
|
|
+ {'__id': 'Place_tokens', '__type': 'AttributeLink', '__source': 'Place', '__target': 'Natural', 'name': 'tokens', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
+ {'__id': 'Place_name', '__type': 'AttributeLink', '__source': 'Place', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
+ {'__id': 'Transition', '__type': 'Class', 'lower_cardinality': None, 'upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'Transition', 'abstract': None},
|
|
|
+ {'__id': 'Transition_name', '__type': 'AttributeLink', '__source': 'Transition', '__target': 'String', 'name': 'name', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
+ {'__id': 'P2T', '__type': 'Association', '__source': 'Place', '__target': 'Transition', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'P2T'},
|
|
|
+ {'__id': 'P2T_weight', '__type': 'AttributeLink', '__source': 'P2T', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
+ {'__id': 'T2P', '__type': 'Association', '__source': 'Transition', '__target': 'Place', 'source_lower_cardinality': None, 'target_lower_cardinality': None, 'source_upper_cardinality': None, 'target_upper_cardinality': None, 'constraint': {'AL': ''}, 'name': 'T2P'},
|
|
|
+ {'__id': 'T2P_weight', '__type': 'AttributeLink', '__source': 'T2P', '__target': 'Natural', 'name': 'weight', 'optional': False, 'constraint': {'AL': ''}},
|
|
|
]
|
|
|
compare_unordered_lists(got, expected)
|
|
|
|
|
|
got = element_list_nice("test/my_pn")
|
|
|
expected = \
|
|
|
- [{'id': 'p1', 'type': 'Place', 'tokens': 1, 'name': 'p1'},
|
|
|
- {'id': 'p2', 'type': 'Place', 'tokens': 2, 'name': 'p2'},
|
|
|
- {'id': 'p3', 'type': 'Place', 'tokens': 3, 'name': 'p3'},
|
|
|
- {'id': 't1', 'type': 'Transition', 'name': 't1'},
|
|
|
- {'id': '__0', 'type': 'P2T', '__source': 'p1', '__target': 't1', 'weight': 1},
|
|
|
- {'id': '__1', 'type': 'P2T', '__source': 'p2', '__target': 't1', 'weight': 1},
|
|
|
- {'id': '__2', 'type': 'T2P', '__source': 't1', '__target': 'p3', 'weight': 2}
|
|
|
+ [{'__id': 'p1', '__type': 'Place', 'tokens': 1, 'name': 'p1'},
|
|
|
+ {'__id': 'p2', '__type': 'Place', 'tokens': 2, 'name': 'p2'},
|
|
|
+ {'__id': 'p3', '__type': 'Place', 'tokens': 3, 'name': 'p3'},
|
|
|
+ {'__id': 't1', '__type': 'Transition', 'name': 't1'},
|
|
|
+ {'__id': '__0', '__type': 'P2T', '__source': 'p1', '__target': 't1', 'weight': 1},
|
|
|
+ {'__id': '__1', '__type': 'P2T', '__source': 'p2', '__target': 't1', 'weight': 1},
|
|
|
+ {'__id': '__2', '__type': 'T2P', '__source': 't1', '__target': 'p3', 'weight': 2}
|
|
|
]
|
|
|
compare_unordered_lists(got, expected)
|
|
|
|
|
@@ -415,8 +415,8 @@ class TestModelverse(unittest.TestCase):
|
|
|
count_nodes = 0
|
|
|
count_edges = 0
|
|
|
for entry in element_list_nice("test/PetriNet"):
|
|
|
- assert entry["type"] in ["Node", "Edge"]
|
|
|
- if entry["type"] == "Node":
|
|
|
+ assert entry["__type"] in ["Node", "Edge"]
|
|
|
+ if entry["__type"] == "Node":
|
|
|
assert len(entry) == 2
|
|
|
count_nodes += 1
|
|
|
else:
|
|
@@ -428,8 +428,8 @@ class TestModelverse(unittest.TestCase):
|
|
|
count_nodes = 0
|
|
|
count_edges = 0
|
|
|
for entry in element_list_nice("test/my_pn"):
|
|
|
- assert entry["type"] in ["Node", "Edge"]
|
|
|
- if entry["type"] == "Node":
|
|
|
+ assert entry["__type"] in ["Node", "Edge"]
|
|
|
+ if entry["__type"] == "Node":
|
|
|
assert len(entry) == 2
|
|
|
count_nodes += 1
|
|
|
else:
|