grantforge-api / backend /tests /test_generator_antiloop.py
GrantForge Bot
Deploy sha-9a5957fcdef15b7e2623f8b147cda6026475aee0 — source build (no GHCR)
3a3734f
Raw
History Blame Contribute Delete
960 Bytes
"""Testy anty-pętli Autopilota (recursion_limit)."""
def test_should_continue_forces_audit_on_graph_step_limit():
from agents.generator_agent import DocumentGeneratorAgent
agent = DocumentGeneratorAgent()
state = {
"sections_plan": [{"title": "A"}, {"title": "B"}],
"current_section_idx": 0,
"is_completed": False,
"missing_data_question": None,
"graph_step": 50,
}
assert agent._should_continue(state) == "audit"
def test_should_continue_skips_resolve_after_stall():
from agents.generator_agent import DocumentGeneratorAgent
agent = DocumentGeneratorAgent()
state = {
"sections_plan": [{"title": "A"}],
"current_section_idx": 0,
"is_completed": False,
"missing_data_question": "Podaj NIP",
"section_stall_counts": {"0": 2},
"graph_step": 3,
}
assert agent._should_continue(state) == "continue"