File size: 1,187 Bytes
3726258
 
 
3f3fbe2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""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