feat: solution for 'Повторный экзамен: Граф с рефлексией и доработкой'
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import pytest
|
||||
from src.graph import build_graph
|
||||
|
||||
|
||||
def test_graph_flow():
|
||||
graph = build_graph()
|
||||
input_state = {"input": "Hello world"}
|
||||
result = graph.invoke(input_state)
|
||||
assert "rewritten" in result
|
||||
expected = (
|
||||
"I notice that you said: 'Hello world'. "
|
||||
"Let's reflect on that."
|
||||
)
|
||||
assert result["rewritten"] == expected
|
||||
@@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
from src.nodes.reflect import ReflectNode
|
||||
|
||||
|
||||
def test_reflect_node():
|
||||
state = {"input": "Hello world"}
|
||||
result = ReflectNode.run(state)
|
||||
assert "reflection" in result
|
||||
expected = (
|
||||
"I see that you said: 'Hello world'. "
|
||||
"Let's reflect on that."
|
||||
)
|
||||
assert result["reflection"] == expected
|
||||
@@ -0,0 +1,18 @@
|
||||
import pytest
|
||||
from src.nodes.rewrite import RewriteNode
|
||||
|
||||
|
||||
def test_rewrite_node():
|
||||
state = {
|
||||
"reflection": (
|
||||
"I see that you said: 'Hello world'. "
|
||||
"Let's reflect on that."
|
||||
)
|
||||
}
|
||||
result = RewriteNode.run(state)
|
||||
assert "rewritten" in result
|
||||
expected = (
|
||||
"I notice that you said: 'Hello world'. "
|
||||
"Let's reflect on that."
|
||||
)
|
||||
assert result["rewritten"] == expected
|
||||
Reference in New Issue
Block a user