Orchestrata Ultimate › Tests › Reference › refactor › codemod › analysis

Tests reference — tests/refactor/codemod/analysis

tests/refactor/codemod/analysis — 12 test modules, 50 test functions. Source tree: tests/refactor/codemod/analysis at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Modules

Module Tests Covers
conftest.py 0 1
test_abstraction.py 3 3
test_blast_radius.py 6 4
test_breaking_change.py 8 5
test_complexity.py 9 4
test_coupling.py 4 3
test_dead_code.py 4 3
test_encode.py 5 3
test_protocol.py 2 6
test_read_only.py 3 7
test_test_coverage.py 6 3

Module details

tests/refactor/codemod/analysis/conftest.py

source · 0 tests · 187 lines

Shared fixture repo for the analysis-pass tests.

Covers: refactor.codemod.workspace

tests/refactor/codemod/analysis/test_abstraction.py

source · 3 tests · 36 lines

AbstractionAnalyzer tests (REQ-110-031). TST-110-015 lives in test_blast_radius.py.

Covers: core.base.traces, refactor.codemod.workspace, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_abstraction_counts_protocol_against_concrete 13
function test_abstraction_of_a_module_without_classes_is_zero 22
function test_abstraction_requires_a_known_target 30

tests/refactor/codemod/analysis/test_blast_radius.py

source · 6 tests · 76 lines

BlastRadiusAnalyzer tests, including TST-110-015 (REQ-110-031).

Covers: core.base.traces, refactor.codemod._types, refactor.codemod.workspace, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_adapter_analyzers_equal_direct_cig_queries 22 TST-110-015: Blast/Coupling/Abstraction results equal the CIG query results.
function test_blast_radius_default_hops_is_three 47
function test_blast_radius_resolves_the_raw_node_key 54
function test_blast_radius_requires_a_target 63
function test_blast_radius_unknown_module_raises 69
function test_blast_radius_has_a_name_for_the_cli 75

tests/refactor/codemod/analysis/test_breaking_change.py

source · 8 tests · 201 lines

BreakingChangeDetector tests, including TST-110-016 (REQ-110-031).

Covers: core.base.traces, refactor.codemod.report, refactor.codemod.workspace, refactor.codemod.analysis/ (package), refactor.ctok/ (package)

Kind Name Line Description
function test_renamed_parameter_reaches_both_importers_and_a_body_edit_none 47 TST-110-016: a renamed parameter yields 2 records; a body-only edit yields 0.
function test_each_changed_signature_reaches_each_importer 68
function test_def_to_async_def_alone_is_a_signature_change 94
function test_renamed_parameter_reaches_every_importer_on_every_real_layout 111 TST-110-016 on the real shapes: src layout, importer-sorts-first, relative.
function test_removed_function_and_changed_return_annotation_count 133
function test_added_function_and_default_changes 151
function test_class_method_signatures_are_diffed 167
function test_target_filters_entries_and_unknown_module_has_no_consumers 183

tests/refactor/codemod/analysis/test_complexity.py

source · 9 tests · 213 lines

ComplexityAnalyzer and ComplexityMetrics tests, including TST-110-017 (REQ-110-031).

Covers: core.base.traces, refactor.codemod._types, refactor.codemod.workspace, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_fixture_functions_have_exact_metrics 31 TST-110-017: known branch counts yield exact cyclomatic/nesting/cognitive values.
function test_whole_forest_report_counts_every_file 68
function test_empty_selection_reports_zero 76
function test_unknown_module_raises 90
function test_qualified_name_is_the_dotted_scope_from_the_ast_walk 98
function test_same_named_methods_in_different_classes_stay_distinct 109 Class names are kept in the qualified name: no duplicate path:name ids.
function test_metrics_exclude_nested_defs_and_cover_async_forms 140
function test_metrics_for_match_lambda_with_and_try_forms 162
function test_elif_chains_do_not_deepen_nesting_but_nested_ifs_do 193

tests/refactor/codemod/analysis/test_coupling.py

source · 4 tests · 48 lines

CouplingAnalyzer tests (REQ-110-031). TST-110-015 lives in test_blast_radius.py.

Covers: core.base.traces, refactor.codemod.workspace, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_coupling_counts_importers_as_afferent 14
function test_coupling_of_an_unimported_module_has_no_afferent 26
function test_coupling_requires_a_known_target 33
function test_importee_has_afferent_coupling_on_every_real_layout 43

tests/refactor/codemod/analysis/test_dead_code.py

source · 4 tests · 73 lines

DeadCodeDetector tests (REQ-110-031): module-granularity reachability (GAP-1).

Covers: core.base.traces, refactor.codemod.workspace, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_unreachable_modules_are_those_no_entry_root_imports 21
function test_target_reports_only_that_module 41
function test_no_entry_roots_reports_nothing 53
function test_importee_imported_from_a_root_is_not_dead_on_every_real_layout 64 The importee is reached through its IMPORTS edges (root -> importer -> lib).

tests/refactor/codemod/analysis/test_encode.py

source · 5 tests · 79 lines

AnalysisResultEncoder tests (REQ-110-032): every result round-trips json.dumps.

Covers: core.base.traces, refactor.codemod._types, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_dataclass_with_frozensets_encodes_to_sorted_lists 20
function test_mapping_keys_become_strings_and_nested_values_encode 39
function test_list_results_carry_the_list_type 52
function test_literal_defaults_round_trip 68
function test_unencodable_values_raise 77

tests/refactor/codemod/analysis/test_protocol.py

source · 2 tests · 58 lines

resolve_node_id and the AnalysisPass protocol (REQ-110-031 / REQ-110-032).

Covers: core.base.traces, refactor.codemod._cig, refactor.codemod._csr_index, refactor.codemod._types, refactor.codemod.analysis.protocol, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_resolve_node_id_tries_module_key_raw_key_then_dotted_form 35
function test_analysis_pass_protocol_requires_name_and_analyze 47

tests/refactor/codemod/analysis/test_read_only.py

source · 3 tests · 123 lines

Read-only proof for the seven analysis passes: TST-110-019 (REQ-110-032).

Covers: core.base.traces, refactor.codemod._cig, refactor.codemod._types, refactor.codemod.report, refactor.codemod.workspace, refactor.codemod.analysis/ (package), refactor.ctok/ (package)

Kind Name Line Description
function test_all_seven_analyzers_leave_graph_and_forest_untouched 39 TST-110-019: node/edge counts and forest bytes are identical; results frozen and JSON-safe.
function test_every_analyzer_satisfies_the_analysis_pass_protocol 84
function test_analyzers_leave_every_real_layout_untouched 102 TST-110-019 on the real shapes, with resolved IMPORTS edges to protect.

tests/refactor/codemod/analysis/test_test_coverage.py

source · 6 tests · 120 lines

TestCoverageMapper tests, including TST-110-018 (REQ-110-031).

Covers: core.base.traces, refactor.codemod.workspace, refactor.codemod.analysis/ (package)

Kind Name Line Description
function test_name_heuristic_maps_a_test_to_its_function_without_a_tested_by_edge 18 TST-110-018: tests/test_lib.py::test_add maps to src/lib.py::add by name.
function test_method_tests_and_same_file_edges_are_covered 37
function test_uncovered_functions_and_ratio 60
function test_target_restricts_to_one_module 81
function test_unknown_module_raises 100
function test_name_heuristic_maps_tests_on_every_real_layout 108 TST-110-018 on the real shapes: the test importing lib maps to add.

Support files

Fixtures, package markers and helpers without test functions.