Orchestrata Ultimate › Tests › Reference › scripts › test_ast_refactor

Tests reference — tests/scripts/test_ast_refactor.py

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

Prose pending.

tests/scripts/test_ast_refactor.py

source · 42 tests · 1019 lines

Tests for the navigation + refactoring subcommands of the AST tool

Kind Name Line Description
function test_symbols_lists_classes_and_methods 49
function test_symbols_pattern_and_kind_filter 63
function test_refs_splits_defs_uses_imports 75
function test_owning_module_for_edge_cases 101
function test_refs_resolves_aliased_from_import 118
function test_refs_resolves_aliased_module_import_attribute_access 143 import X as Z + Z.symbol(...) -- the module-attr aliased form.
function test_refs_resolves_from_package_submodule_attribute_access 175 The 4th binding form: from pkg import mod (no as) binds the
function test_refs_module_disambiguates_duplicate_definitions 200 Two modules define the same name (real case: pytest_sessionfinish
function test_cmd_refs_cli_resolves_real_repo_declare_owned_alias 275
function test_cmd_refs_cli_warns_and_disambiguates_on_module_flag 309
function test_refs_reports_string_literal_evidence_alongside_alias_marker 345 refs carries the same weak/strong evidence distinction unused
function test_cmd_unused_cli_explicit_ref_source_widens_scan 363
function test_cmd_unused_cli_reports_pytest_hook_exemption 378
function test_cmd_unused_cli_default_ref_source_is_whole_project 394 No --ref-source -- the CLI must widen to the whole project
function test_rename_func_is_token_precise_and_dry_run_does_not_write 420
function test_rename_class_updates_usage 454
function test_rename_method_updates_attribute_access 464
function test_rename_rejects_invalid_identifier 481
function test_unused_flags_unreferenced_def_only 491
function test_unused_respects_dunder_all_exports 504
function test_unused_scans_references_project_wide_independent_of_definition_scope 525
function test_unused_reports_string_literal_only_symbol_with_evidence_and_site 563
function test_unused_still_fully_suppresses_a_genuinely_code_referenced_symbol 579 The other half of the same fix: a real Name/Attribute reference must
function test_pytest_hook_fallback_list_is_plain_readable_literals 597 The obfuscated joined-blob-split-at-runtime workaround is gone now
function test_unused_exempts_pytest_hooks_with_visible_reason 639
function test_unused_pytest_hook_exemption_cites_structural_p_registration 659 When a -p "<dotted.module>" argv literal IS in the scanned sources,
function test_rename_func_skips_shadowing_local 686 Renaming a module-level function must not touch a same-named local/param
function test_rename_class_catches_bare_and_qualified_instantiation 706 A class rename fixes every site that instantiates it — bare OldClass()
function test_rename_func_catches_qualified_call_but_not_foreign_attr 724 A function rename fixes module-qualified calls lib.run() but must NOT
function test_rename_method_class_scopes_definition 743
function test_rename_method_class_type_scopes_call_sites 758 With --class, call sites are rewritten only for receivers whose type
function test_rename_method_class_fails_closed_on_unresolved_receiver 787 Fail-closed: an untyped receiver x.run() makes the rename partial, so
function test_rename_method_class_applies_when_all_receivers_resolved 811 With every receiver typed, there is nothing unresolved, so the rename is
function test_rename_module_updates_imports_and_moves_file 837
function test_rename_module_from_import_dotted_path 852
function test_rename_class_rewrites_function_scoped_import_and_its_use 863 Regression: a function-scoped from ... import OldName is NOT a
function test_rename_class_respects_genuine_local_reassignment 887 A real shadow -- a local reassignment of the same name, with no
function test_rename_func_rewrites_bare_load_references 908 A func rename must rewrite every bare Load-context reference — a name
function test_rename_class_rewrites_function_scoped_import_as_alias 943 The import x as OldName alias form binds OldName the same way a
function test_rename_class_rewrites_both_sides_of_a_self_aliased_reexport 966 from mod import Y as Y must rewrite BOTH sides, not just the alias.
function test_rename_class_rewrites_the_origin_of_a_renamed_import 984 from mod import Y as Z must rewrite the ORIGIN, keeping the alias.
function test_rename_leaves_a_module_alias_origin_alone 1006 import mod as OldName must not have its MODULE path rewritten.