44import pytest
55
66from 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+ )
813
914
1015@pytest .fixture
@@ -36,40 +41,40 @@ def test_get_main_graph(mock_agent):
3641 assert '"__start__" [shape=ellipse, style=filled, fillcolor=lightblue];' in result
3742 assert '"__end__" [shape=ellipse, style=filled, fillcolor=lightblue];' in result
3843 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
4146 )
4247 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
4550 )
4651 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
4954 )
5055 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
5358 )
5459
5560
5661def test_get_all_nodes (mock_agent ):
5762 result = get_all_nodes (mock_agent )
5863 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
6166 )
6267 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
6570 )
6671 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
6974 )
7075 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
7378 )
7479
7580
@@ -94,18 +99,18 @@ def test_draw_graph(mock_agent):
9499 assert '"__start__" [shape=ellipse, style=filled, fillcolor=lightblue];' in graph .source
95100 assert '"__end__" [shape=ellipse, style=filled, fillcolor=lightblue];' in graph .source
96101 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
99104 )
100105 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
103108 )
104109 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
107112 )
108113 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
111116 )
0 commit comments