Orchestrata Ultimate › Tests › Reference › test_orchestrata_ast_analyzer

Tests reference — tests/test_orchestrata_ast_analyzer.py

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

Prose pending.

tests/test_orchestrata_ast_analyzer.py

source · 38 tests · 709 lines

Tests for orchestrata_ast.analyzer.CodebaseAnalyzer.

Kind Name Line Description
class TestFindPythonFilesMonorepo 37
method TestFindPythonFilesMonorepo.test_scans_orchestrata_prefixed_package_src_dirs 38
class TestFileToModulePathMonorepo 53
method TestFileToModulePathMonorepo.test_src_segment_present_strips_prefix 54
method TestFileToModulePathMonorepo.test_no_src_segment_falls_back_to_relative 66
class TestFileToModulePathNonMonorepo 73
method TestFileToModulePathNonMonorepo.test_relative_to_root_succeeds 74
method TestFileToModulePathNonMonorepo.test_relative_to_fails_but_src_segment_present 82
method TestFileToModulePathNonMonorepo.test_relative_to_fails_and_no_src_segment_uses_full_parts 88
method TestFileToModulePathNonMonorepo.test_strips_trailing_dunder_init 95
class TestAnalyzeFileErrorPaths 101
method TestAnalyzeFileErrorPaths.test_syntax_error_returns_none 102
method TestAnalyzeFileErrorPaths.test_unicode_decode_error_returns_none 107
method TestAnalyzeFileErrorPaths.test_analyze_skips_unparseable_file_in_full_run 115
class TestModuleLevelVarsAndAllExports 123
method TestModuleLevelVarsAndAllExports.test_module_var_and_all_exports_and_docstring 124
method TestModuleLevelVarsAndAllExports.test_all_exports_as_tuple_and_non_string_elements_are_skipped 143
class TestAnalyzeClassBaseUnparseExceptionFallback 161
method TestAnalyzeClassBaseUnparseExceptionFallback.test_falls_back_to_name_id_when_unparse_raises 162
class TestAnalyzeClassBodyMembers 198
method TestAnalyzeClassBodyMembers.test_class_var_classvar_annotation_and_inner_class 199
class TestExtractParamsDefaultUnparseExceptionFallback 223
method TestExtractParamsDefaultUnparseExceptionFallback.test_positional_default_unparse_failure_falls_back_to_ellipsis 224
method TestExtractParamsDefaultUnparseExceptionFallback.test_kwonly_default_unparse_failure_falls_back_to_ellipsis 239
class TestGetDecoratorsUnparseExceptionFallback 255
method TestGetDecoratorsUnparseExceptionFallback.test_name_decorator_unparse_failure_falls_back_to_id 256
method TestGetDecoratorsUnparseExceptionFallback.test_attribute_decorator_unparse_failure_falls_back_to_attr 269
class TestExtractCallsUnparseExceptionFallback 285
method TestExtractCallsUnparseExceptionFallback.test_call_with_unparseable_func_is_silently_skipped 286
class TestAnalyzeAnnotation 300
method TestAnalyzeAnnotation.test_non_name_target_returns_none 301
method TestAnalyzeAnnotation.test_value_unparse_failure_falls_back_to_ellipsis 310
class TestComputeDerivedInheritanceAndPydanticPropagation 324
method TestComputeDerivedInheritanceAndPydanticPropagation.test_resolves_bases_and_propagates_pydantic_two_levels_deep 325
class TestDependencyGraphNormalization 356 Regression: dependency_graph targets must join with module paths.
method TestDependencyGraphNormalization.test_internal_imports_normalized_to_module_path_space 365
method TestDependencyGraphNormalization.test_prefix_stripped_only_when_target_is_a_real_module 386
method TestDependencyGraphNormalization.test_script_style_sibling_import_resolves_through_the_package 397 A module run as a script imports its siblings BARE.
method TestDependencyGraphNormalization.test_stdlib_name_is_not_captured_by_a_shadowing_project_module 415 A project module named after a stdlib module must not swallow it.
method TestDependencyGraphNormalization.test_shadowing_module_importing_its_own_stdlib_namesake_has_no_self_edge 437 core/logging.py doing import logging means the STDLIB one.
class TestByteExactCapture 455 2026-08-02 user mandate: "the AST must capture byte-identical code --
method TestByteExactCapture.test_method_body_hash_present_and_16_hex 462
method TestByteExactCapture.test_method_body_hash_changes_on_body_byte_edit_unrelated_stays_same 474 A single byte changed inside one method's body changes ONLY that
method TestByteExactCapture.test_class_body_hash_present_and_covers_methods_and_class_vars 507
method TestByteExactCapture.test_top_level_function_body_hash_and_end_line 520
method TestByteExactCapture.test_residue_hash_changes_when_module_var_changes_bodies_unchanged 531 A module-level constant edit changes residue_hash while every
method TestByteExactCapture.test_body_hash_empty_when_no_text_supplied 566 Direct low-level calls without source text (e.g. a synthetic node)
class TestJSONASTLoaderOldFormatBackcompat 580 The old-format snapshot (pre-2026-08-02, no body_hash/end_line/
method TestJSONASTLoaderOldFormatBackcompat.test_old_format_dict_without_new_keys_loads 585
method TestJSONASTLoaderOldFormatBackcompat.test_module_info_from_dict_old_format_defaults_new_fields 626 The OTHER loader -- orchestrata_ast.analyzer's own
class TestImportAliasCapture 668 Regression: plain import x as y must carry the asname.
method TestImportAliasCapture.test_single_plain_import_alias_captured 677
method TestImportAliasCapture.test_plain_import_without_alias_stays_none 688
method TestImportAliasCapture.test_multi_name_plain_import_unrepresentable_alias_is_none 697