test_modeling_add   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 29
dl 0
loc 53
rs 10
c 0
b 0
f 0

4 Functions

Rating   Name   Duplication   Size   Complexity  
A test_add_graph_models_edge_generators() 0 10 1
A test_add_graph_models_node_models() 0 10 1
A test_add_graph_models_names() 0 6 1
A test_add_graph_models_node_children() 0 10 1
1
#  [MermaidChart: 31f25fab-3a92-4cc4-bb11-71e8012c8ece]
2
#  [MermaidChart: 31f25fab-3a92-4cc4-bb11-71e8012c8ece]
3
#  [MermaidChart: 31f25fab-3a92-4cc4-bb11-71e8012c8ece]
4
# tests/test_modeling.py
5
6
from collections import defaultdict
7
8
from src.graphinate.modeling import GraphModel
9
10
11
def test_add_graph_models_names():
12
    model_a = GraphModel(name="ModelA")
13
    model_b = GraphModel(name="ModelB")
14
    combined_model = model_a + model_b
15
16
    assert combined_model.name == "ModelA + ModelB"
17
18
19
def test_add_graph_models_node_models():
20
    model_a = GraphModel(name="ModelA")
21
    model_b = GraphModel(name="ModelB")
22
23
    model_a._node_models = defaultdict(list, {"type1": ["node1"]})
24
    model_b._node_models = defaultdict(list, {"type1": ["node2"]})
25
26
    combined_model = model_a + model_b
27
28
    assert combined_model._node_models["type1"] == ["node1", "node2"]
29
30
31
def test_add_graph_models_edge_generators():
32
    model_a = GraphModel(name="ModelA")
33
    model_b = GraphModel(name="ModelB")
34
35
    model_a._edge_generators = defaultdict(list, {"edge1": ["gen1"]})
36
    model_b._edge_generators = defaultdict(list, {"edge1": ["gen2"]})
37
38
    combined_model = model_a + model_b
39
40
    assert combined_model._edge_generators["edge1"] == ["gen1", "gen2"]
41
42
43
def test_add_graph_models_node_children():
44
    model_a = GraphModel(name="ModelA")
45
    model_b = GraphModel(name="ModelB")
46
47
    model_a._node_children = defaultdict(list, {"child1": ["child_a"]})
48
    model_b._node_children = defaultdict(list, {"child1": ["child_b"]})
49
50
    combined_model = model_a + model_b
51
52
    assert combined_model._node_children["child1"] == ["child_a", "child_b"]
53