4
4
import pytest
5
5
6
6
from agents import Agent
7
- from agents .extensions .visualization import draw_graph , get_all_edges , get_all_nodes , get_main_graph
7
+ from agents .extensions .visualization import (
8
+ draw_graph ,
9
+ get_all_edges ,
10
+ get_all_nodes ,
11
+ get_main_graph ,
12
+ )
8
13
9
14
10
15
@pytest .fixture
@@ -36,40 +41,40 @@ def test_get_main_graph(mock_agent):
36
41
assert '"__start__" [shape=ellipse, style=filled, fillcolor=lightblue];' in result
37
42
assert '"__end__" [shape=ellipse, style=filled, fillcolor=lightblue];' in result
38
43
assert (
39
- '"Agent1" [label="Agent1", shape=box, style=filled, fillcolor=lightyellow, width=1.5, height=0.8]; '
40
- in result
44
+ '"Agent1" [label="Agent1", shape=box, style=filled, '
45
+ "fillcolor=lightyellow, width=1.5, height=0.8];" in result
41
46
)
42
47
assert (
43
- '"Tool1" [label="Tool1", shape=ellipse, style=filled, fillcolor=lightgreen, width=0.5, height=0.3]; '
44
- in result
48
+ '"Tool1" [label="Tool1", shape=ellipse, style=filled, '
49
+ "fillcolor=lightgreen, width=0.5, height=0.3];" in result
45
50
)
46
51
assert (
47
- '"Tool2" [label="Tool2", shape=ellipse, style=filled, fillcolor=lightgreen, width=0.5, height=0.3]; '
48
- in result
52
+ '"Tool2" [label="Tool2", shape=ellipse, style=filled, '
53
+ "fillcolor=lightgreen, width=0.5, height=0.3];" in result
49
54
)
50
55
assert (
51
- '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, fillcolor=lightyellow, width=1.5, height=0.8]; '
52
- in result
56
+ '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, '
57
+ "fillcolor=lightyellow, width=1.5, height=0.8];" in result
53
58
)
54
59
55
60
56
61
def test_get_all_nodes (mock_agent ):
57
62
result = get_all_nodes (mock_agent )
58
63
assert (
59
- '"Agent1" [label="Agent1", shape=box, style=filled, fillcolor=lightyellow, width=1.5, height=0.8]; '
60
- in result
64
+ '"Agent1" [label="Agent1", shape=box, style=filled, '
65
+ "fillcolor=lightyellow, width=1.5, height=0.8];" in result
61
66
)
62
67
assert (
63
- '"Tool1" [label="Tool1", shape=ellipse, style=filled, fillcolor=lightgreen, width=0.5, height=0.3]; '
64
- in result
68
+ '"Tool1" [label="Tool1", shape=ellipse, style=filled, '
69
+ "fillcolor=lightgreen, width=0.5, height=0.3];" in result
65
70
)
66
71
assert (
67
- '"Tool2" [label="Tool2", shape=ellipse, style=filled, fillcolor=lightgreen, width=0.5, height=0.3]; '
68
- in result
72
+ '"Tool2" [label="Tool2", shape=ellipse, style=filled, '
73
+ "fillcolor=lightgreen, width=0.5, height=0.3];" in result
69
74
)
70
75
assert (
71
- '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, fillcolor=lightyellow, width=1.5, height=0.8]; '
72
- in result
76
+ '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, '
77
+ "fillcolor=lightyellow, width=1.5, height=0.8];" in result
73
78
)
74
79
75
80
@@ -94,18 +99,18 @@ def test_draw_graph(mock_agent):
94
99
assert '"__start__" [shape=ellipse, style=filled, fillcolor=lightblue];' in graph .source
95
100
assert '"__end__" [shape=ellipse, style=filled, fillcolor=lightblue];' in graph .source
96
101
assert (
97
- '"Agent1" [label="Agent1", shape=box, style=filled, fillcolor=lightyellow, width=1.5, height=0.8]; '
98
- in graph .source
102
+ '"Agent1" [label="Agent1", shape=box, style=filled, '
103
+ "fillcolor=lightyellow, width=1.5, height=0.8];" in graph .source
99
104
)
100
105
assert (
101
- '"Tool1" [label="Tool1", shape=ellipse, style=filled, fillcolor=lightgreen, width=0.5, height=0.3]; '
102
- in graph .source
106
+ '"Tool1" [label="Tool1", shape=ellipse, style=filled, '
107
+ "fillcolor=lightgreen, width=0.5, height=0.3];" in graph .source
103
108
)
104
109
assert (
105
- '"Tool2" [label="Tool2", shape=ellipse, style=filled, fillcolor=lightgreen, width=0.5, height=0.3]; '
106
- in graph .source
110
+ '"Tool2" [label="Tool2", shape=ellipse, style=filled, '
111
+ "fillcolor=lightgreen, width=0.5, height=0.3];" in graph .source
107
112
)
108
113
assert (
109
- '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, fillcolor=lightyellow, width=1.5, height=0.8]; '
110
- in graph .source
114
+ '"Handoff1" [label="Handoff1", shape=box, style=filled, style=rounded, '
115
+ "fillcolor=lightyellow, width=1.5, height=0.8];" in graph .source
111
116
)
0 commit comments