-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_inline_declaration.py
54 lines (50 loc) · 1.91 KB
/
test_inline_declaration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from fluentm.entities import Boundary, Process, DataFlow
from fluentm.renderer import dfd, renderDfd
# Example using completely new objects created only here, inline
scenes = {
"Warehouse packages order": [
DataFlow(
Process("Order Resolver").inBoundary(Boundary("Logistics")),
Process("Label Printer").inBoundary(Boundary("Warehouse")),
"Print label",
),
DataFlow(
Process.get("Label Printer"), Process.get("Order Resolver"), "Label ID"
),
DataFlow(
Process.get("Order Resolver"),
Process("Warehouse Notifier").inBoundary(Boundary.get("Warehouse")),
"Pick stock item and use label",
),
DataFlow(
Process.get("Warehouse Notifier"),
Process.get("Order Resolver"),
"Confirmation ID",
),
] # TODO: Fix silent error on repeat label names
}
expectedResults = {
"Warehouse packages order": """digraph "Warehouse packages order" {
color=blue fontname=Arial rankdir=LR
node [fontname=Arial fontsize=11 shape=box style=rounded]
edge [fontname=Arial fontsize=11]
subgraph cluster_Logistics {
graph [color=red fontname=Arial fontsize=11 label=Logistics style=dashed]
"Order Resolver"
}
subgraph cluster_Warehouse {
graph [color=red fontname=Arial fontsize=11 label=Warehouse style=dashed]
"Label Printer"
"Warehouse Notifier"
}
"Order Resolver" -> "Label Printer" [label="(1) Print label"]
"Label Printer" -> "Order Resolver" [label="(2) Label ID"]
"Order Resolver" -> "Warehouse Notifier" [label="(3) Pick stock item and use label"]
"Warehouse Notifier" -> "Order Resolver" [label="(4) Confirmation ID"]
}"""
}
def test_dfd():
graph = dfd(scenes, "Warehouse packages order")
# print(graph)
renderDfd(graph, "Warehouse packages order", outputDir="testOutput")
assert graph.__str__() == expectedResults["Warehouse packages order"]