feat: solution for 'Повторный экзамен: Граф с рефлексией и доработкой'

This commit is contained in:
2026-07-01 16:20:51 +03:00
parent 5801947c0d
commit c776326204
10 changed files with 258 additions and 258 deletions
+14
View File
@@ -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
+13
View File
@@ -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
+18
View File
@@ -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