Skip to content

Commit 8f59271

Browse files
committed
Update functional tests to include all file formats
1 parent 87d308f commit 8f59271

File tree

8 files changed

+115
-15
lines changed

8 files changed

+115
-15
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
digraph "classes" {
2+
rankdir=BT
3+
charset="utf-8"
4+
"comprehensions.AggregationContainer" [color="black", fontcolor="black", label=<{AggregationContainer|component_dict : dict[str, Component]<br ALIGN="LEFT"/>components : list[Component]<br ALIGN="LEFT"/>components_set : set[Component]<br ALIGN="LEFT"/>lazy_components : Generator[Component]<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
5+
"comprehensions.AssociationContainer" [color="black", fontcolor="black", label=<{AssociationContainer|component_dict : dict[int, Component]<br ALIGN="LEFT"/>components : list[Component]<br ALIGN="LEFT"/>components_set : set[Component]<br ALIGN="LEFT"/>lazy_components : Generator[Component]<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
6+
"comprehensions.Component" [color="black", fontcolor="black", label=<{Component|name : str<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
7+
"comprehensions.CompositionContainer" [color="black", fontcolor="black", label=<{CompositionContainer|component_dict : dict[int, Component]<br ALIGN="LEFT"/>components : list[Component]<br ALIGN="LEFT"/>components_set : set[Component]<br ALIGN="LEFT"/>lazy_components : Generator[Component]<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
8+
"comprehensions.Component" -> "comprehensions.AssociationContainer" [arrowhead="vee", arrowtail="none", fontcolor="green", label="components", style="solid"];
9+
"comprehensions.Component" -> "comprehensions.AssociationContainer" [arrowhead="vee", arrowtail="none", fontcolor="green", label="component_dict", style="solid"];
10+
"comprehensions.Component" -> "comprehensions.AssociationContainer" [arrowhead="vee", arrowtail="none", fontcolor="green", label="components_set", style="solid"];
11+
"comprehensions.Component" -> "comprehensions.AssociationContainer" [arrowhead="vee", arrowtail="none", fontcolor="green", label="lazy_components", style="solid"];
12+
"comprehensions.Component" -> "comprehensions.CompositionContainer" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="components", style="solid"];
13+
"comprehensions.Component" -> "comprehensions.CompositionContainer" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="component_dict", style="solid"];
14+
"comprehensions.Component" -> "comprehensions.CompositionContainer" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="components_set", style="solid"];
15+
"comprehensions.Component" -> "comprehensions.CompositionContainer" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="lazy_components", style="solid"];
16+
"comprehensions.Component" -> "comprehensions.AggregationContainer" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="components", style="solid"];
17+
"comprehensions.Component" -> "comprehensions.AggregationContainer" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="component_dict", style="solid"];
18+
"comprehensions.Component" -> "comprehensions.AggregationContainer" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="components_set", style="solid"];
19+
"comprehensions.Component" -> "comprehensions.AggregationContainer" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="lazy_components", style="solid"];
20+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@startuml classes
2+
set namespaceSeparator none
3+
class "AggregationContainer" as comprehensions.AggregationContainer {
4+
component_dict : dict[str, Component]
5+
components : list[Component]
6+
components_set : set[Component]
7+
lazy_components : Generator[Component]
8+
}
9+
class "AssociationContainer" as comprehensions.AssociationContainer {
10+
component_dict : dict[int, Component]
11+
components : list[Component]
12+
components_set : set[Component]
13+
lazy_components : Generator[Component]
14+
}
15+
class "Component" as comprehensions.Component {
16+
name : str
17+
}
18+
class "CompositionContainer" as comprehensions.CompositionContainer {
19+
component_dict : dict[int, Component]
20+
components : list[Component]
21+
components_set : set[Component]
22+
lazy_components : Generator[Component]
23+
}
24+
comprehensions.Component --> comprehensions.AssociationContainer : components
25+
comprehensions.Component --> comprehensions.AssociationContainer : component_dict
26+
comprehensions.Component --> comprehensions.AssociationContainer : components_set
27+
comprehensions.Component --> comprehensions.AssociationContainer : lazy_components
28+
comprehensions.Component --* comprehensions.CompositionContainer : components
29+
comprehensions.Component --* comprehensions.CompositionContainer : component_dict
30+
comprehensions.Component --* comprehensions.CompositionContainer : components_set
31+
comprehensions.Component --* comprehensions.CompositionContainer : lazy_components
32+
comprehensions.Component --o comprehensions.AggregationContainer : components
33+
comprehensions.Component --o comprehensions.AggregationContainer : component_dict
34+
comprehensions.Component --o comprehensions.AggregationContainer : components_set
35+
comprehensions.Component --o comprehensions.AggregationContainer : lazy_components
36+
@enduml
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[testoptions]
2+
output_formats=mmd,dot,puml
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
digraph "classes" {
2+
rankdir=BT
3+
charset="utf-8"
4+
"fields.Aggregation1" [color="black", fontcolor="black", label=<{Aggregation1|x<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
5+
"fields.Aggregation2" [color="black", fontcolor="black", label=<{Aggregation2|x<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
6+
"fields.Association" [color="black", fontcolor="black", label=<{Association|x<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
7+
"fields.Composition1" [color="black", fontcolor="black", label=<{Composition1|x<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
8+
"fields.Composition2" [color="black", fontcolor="black", label=<{Composition2|x<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
9+
"fields.P" [color="black", fontcolor="black", label=<{P|<br ALIGN="LEFT"/>|}>, shape="record", style="solid"];
10+
"fields.P" -> "fields.Association" [arrowhead="vee", arrowtail="none", fontcolor="green", label="x", style="solid"];
11+
"fields.P" -> "fields.Composition1" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="x", style="solid"];
12+
"fields.P" -> "fields.Composition2" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="x", style="solid"];
13+
"fields.P" -> "fields.Aggregation1" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="x", style="solid"];
14+
"fields.P" -> "fields.Aggregation2" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="x", style="solid"];
15+
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
classDiagram
2-
class A {
2+
class Aggregation1 {
33
x
44
}
5-
class B {
5+
class Aggregation2 {
66
x
77
}
8-
class C {
8+
class Association {
99
x
1010
}
11-
class D {
11+
class Composition1 {
1212
x
1313
}
14-
class E {
14+
class Composition2 {
1515
x
1616
}
1717
class P {
1818
}
19-
P --> A : x
20-
P --* D : x
21-
P --* E : x
22-
P --o B : x
23-
P --o C : x
19+
P --> Association : x
20+
P --* Composition1 : x
21+
P --* Composition2 : x
22+
P --o Aggregation1 : x
23+
P --o Aggregation2 : x
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@startuml classes
2+
set namespaceSeparator none
3+
class "Aggregation1" as fields.Aggregation1 {
4+
x
5+
}
6+
class "Aggregation2" as fields.Aggregation2 {
7+
x
8+
}
9+
class "Association" as fields.Association {
10+
x
11+
}
12+
class "Composition1" as fields.Composition1 {
13+
x
14+
}
15+
class "Composition2" as fields.Composition2 {
16+
x
17+
}
18+
class "P" as fields.P {
19+
}
20+
fields.P --> fields.Association : x
21+
fields.P --* fields.Composition1 : x
22+
fields.P --* fields.Composition2 : x
23+
fields.P --o fields.Aggregation1 : x
24+
fields.P --o fields.Aggregation2 : x
25+
@enduml

tests/pyreverse/functional/class_diagrams/associations/fields.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
class P:
44
pass
55

6-
class A:
6+
class Association:
77
x: P # just type hint, no ownership → Association
88

9-
class B:
9+
class Aggregation1:
1010
def __init__(self, x: P):
1111
self.x = x # receives object, not created → Aggregation
1212

13-
class C:
13+
class Aggregation2:
1414
x: P
1515
def __init__(self, x: P):
1616
self.x = x # receives object, not created → Aggregation
1717

18-
class D:
18+
class Composition1:
1919
x: P
2020
def __init__(self):
2121
self.x = P() # creates object → Composition
2222

23-
class E:
23+
class Composition2:
2424
def __init__(self):
2525
self.x = P() # creates object → Composition
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[testoptions]
2+
output_formats=mmd,dot,puml

0 commit comments

Comments
 (0)