strange-bench / code /tests /test_audit_mode_defaults.py
sidgairo18's picture
Generation code: generic documentation
3726258 verified
Raw History Blame Contribute Delete
1.19 kB
"""Lean-mode defaults of the stage-3 audit: score threshold raised to 0.50, missing classes never
flagged.
"""
from argparse import Namespace
from strangebench.audit.audit_diffusion_scenes import LEAN_SCORE_THR, apply_mode_defaults
def ns(**kw) -> Namespace:
base = dict(audit_mode="lean", score_thr=0.30, check_layout_fidelity=False, no_layout_fidelity=False,
also_flag_missing=True)
base.update(kw)
return Namespace(**base)
def test_lean_bumps_score_thr_and_enables_layout_check():
a = ns()
apply_mode_defaults(a)
assert a.score_thr == LEAN_SCORE_THR == 0.50
assert a.check_layout_fidelity and not a.also_flag_missing
def test_lean_keeps_an_explicit_high_threshold():
a = ns(score_thr=0.6)
apply_mode_defaults(a)
assert a.score_thr == 0.6
def test_lean_bump_does_not_depend_on_no_layout_fidelity():
a = ns(no_layout_fidelity=True)
apply_mode_defaults(a)
assert a.score_thr == LEAN_SCORE_THR and not a.check_layout_fidelity
def test_strict_mode_is_untouched():
a = ns(audit_mode="strict")
apply_mode_defaults(a)
assert a.score_thr == 0.30 and a.also_flag_missing and not a.check_layout_fidelity