Files
assafelovic__gpt-researcher/tests/test_multi_agents_fact_revisions.py
Bartok9 3dcb8392ce fix(multi_agents): bound fact-checker writer revision loop
Add fact_check_revision_count and max_fact_check_revisions (default 3)
so fact_checker→writer cannot stack overflow via recursion_limit.

(cherry picked from commit 69381ff233)
2026-07-14 12:24:32 +03:00

28 lines
842 B
Python

import importlib.util
from pathlib import Path
import pytest
PATH = Path(__file__).resolve().parents[1] / "multi_agents" / "agents" / "fact_review.py"
spec = importlib.util.spec_from_file_location("fact_review", PATH)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
def test_accept_none_notes():
assert mod.route_fact_check({"fact_check_notes": None}) == "accept"
def test_revise_until_limit():
assert mod.route_fact_check(
{"fact_check_notes": "fix X", "fact_check_revision_count": 2},
max_fact_check_revisions=2,
) == "revise"
def test_raises_past_limit():
with pytest.raises(mod.MaxFactCheckRevisionsExceededError):
mod.route_fact_check(
{"fact_check_notes": "still bad", "fact_check_revision_count": 3},
max_fact_check_revisions=2,
)