Orchestrata Ultimate › Tests › Reference › claude › test_autoformat

Tests reference — tests/claude/test_autoformat.py

Module of tests/claude, split out because the directory page would be too large.

Prose pending.

tests/claude/test_autoformat.py

source · 12 tests · 234 lines

Tests for claude/hooks/autoformat.py — the PostToolUse auto-formatter.

Kind Name Line Description
class TestNeverDeletesCode 76
method TestNeverDeletesCode.test_import_added_before_its_first_use_survives 77 THE regression: import os added in edit N, used in edit N+1.
method TestNeverDeletesCode.test_unused_variable_survives 93 F841 also deletes code, and is equally premature mid-edit.
method TestNeverDeletesCode.test_from_import_added_before_use_survives 105 The from x import Y shape — how factory_decision.py lost
method TestNeverDeletesCode.test_still_deletes_nothing_on_a_second_pass 116 Re-stripping on a LATER edit is what re-broke files already
class TestSafeFixesStillApply 136
method TestSafeFixesStillApply.test_black_still_reformats 137
method TestSafeFixesStillApply.test_imports_are_still_sorted 146 isort (I001) reorders but never removes, so it stays enabled.
class TestHookContract 163
method TestHookContract.test_missing_file_exits_zero 164
method TestHookContract.test_unparseable_stdin_exits_zero 168
method TestHookContract.test_syntactically_invalid_python_is_left_alone 178 A file mid-write may not parse yet; the hook must not mangle it.
method TestHookContract.test_json_is_normalized 189
method TestHookContract.test_lockfile_json_is_never_touched 198
class TestDenylistMatchesConfig 214
method TestDenylistMatchesConfig.test_never_autofix_rules_are_all_selected 215 A rule in _NEVER_AUTOFIX that is NOT selected is dead config, and