Download code/tests/test_audit_mode_defaults.py from sidgairo18/strange-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/datasets/sidgairo18/strange-bench/resolve/main/code/tests/test_audit_mode_defaults.py
- Command line
-
hf download hf://datasets/sidgairo18/strange-bench/code/tests/test_audit_mode_defaults.py
-
curl -L -o test_audit_mode_defaults.py https://huggingface.co/datasets/sidgairo18/strange-bench/resolve/main/code/tests/test_audit_mode_defaults.py
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 | |