forked from neuronaut73/langflow2langgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_graph.py
More file actions
56 lines (45 loc) · 1.5 KB
/
test_graph.py
File metadata and controls
56 lines (45 loc) · 1.5 KB
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
55
56
from generated_graph import create_graph
def test_simple_input():
# Create the graph
app = create_graph()
# Test with a simple input
test_input = {
"input": "This is a test message that needs to be processed."
}
print("Input:", test_input)
print("\nProcessing...\n")
try:
# Run the graph
result = app.invoke(test_input)
print("Output:", result)
print("\nStatus: Success ✅")
except Exception as e:
print(f"Error: {str(e)}")
print("\nStatus: Failed ❌")
def test_multiple_inputs():
app = create_graph()
# Test with multiple different inputs
test_cases = [
{"input": "Short test."},
{"input": "A longer test message that contains multiple words and should be processed."},
{"input": ""}, # Empty input to test error handling
]
for i, test_input in enumerate(test_cases, 1):
print(f"\nTest Case {i}")
print("-" * 40)
print("Input:", test_input)
try:
result = app.invoke(test_input)
print("Output:", result)
print("Status: Success ✅")
except Exception as e:
print(f"Error: {str(e)}")
print("Status: Failed ❌")
if __name__ == "__main__":
print("=== Testing Generated Graph ===\n")
print("Test 1: Simple Input")
print("-" * 40)
test_simple_input()
print("\nTest 2: Multiple Inputs")
print("-" * 40)
test_multiple_inputs()