WitnessBox / tests /test_contradictions.py
Farseen0's picture
Deploy WitnessBox
c519923 verified
Raw
History Blame Contribute Delete
1.8 kB
"""The catch engine must fire on the exact cues and stay quiet otherwise."""
from witnessbox.contradictions import ContradictionEngine
def test_timeline_catch():
eng = ContradictionEngine()
r = eng.detect(
"The wire cleared on March 6th — before the board approved it on the 14th.",
caught_ids=set(),
)
assert r is not None and r.is_catch and r.lie.id == "timeline"
def test_authorization_catch():
eng = ContradictionEngine()
r = eng.detect(
"Anything over $5 million requires the CFO's sign-off — and your credentials are on the authorization log.",
caught_ids=set(),
)
assert r is not None and r.is_catch and r.lie.id == "authorization"
def test_relationship_catch():
eng = ContradictionEngine()
r = eng.detect(
"You were cc'd on Meridian's incorporation filing two years ago — Dana Voss, your old colleague.",
caught_ids=set(),
)
assert r is not None and r.is_catch and r.lie.id == "relationship"
def test_irrelevant_question_is_not_a_catch():
eng = ContradictionEngine()
r = eng.detect("Were you in the office on Tuesday morning?", caught_ids=set())
assert r is None or not r.is_catch
def test_partial_authorization_is_not_a_catch():
# Naming the CFO sign-off alone (no policy/log backing) is a near-miss, not a catch.
eng = ContradictionEngine()
r = eng.detect("Didn't you authorize it yourself?", caught_ids=set())
assert r is not None and not r.is_catch # gate passes, score short
def test_already_caught_lie_is_skipped():
eng = ContradictionEngine()
r = eng.detect(
"The wire cleared on March 6th, before the board approved it on the 14th.",
caught_ids={"timeline"},
)
assert r is None or r.lie.id != "timeline"