Skip to content

Commit c4ab7d4

Browse files
Synchronize AST helper guard inventory with helper imports
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent dd2d3bd commit c4ab7d4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_ast_function_source_helper_usage.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,21 @@ def test_ast_guard_modules_reuse_shared_collect_function_sources_helper():
3636
violating_modules.append(module_path)
3737

3838
assert violating_modules == []
39+
40+
41+
def test_ast_guard_inventory_stays_in_sync_with_helper_imports():
42+
excluded_modules = {
43+
"tests/test_ast_function_source_helper_usage.py",
44+
"tests/test_ast_function_source_utils.py",
45+
}
46+
discovered_modules: list[str] = []
47+
for module_path in sorted(Path("tests").glob("test_*.py")):
48+
normalized_path = module_path.as_posix()
49+
if normalized_path in excluded_modules:
50+
continue
51+
module_text = module_path.read_text(encoding="utf-8")
52+
if "ast_function_source_utils import collect_function_sources" not in module_text:
53+
continue
54+
discovered_modules.append(normalized_path)
55+
56+
assert sorted(AST_FUNCTION_SOURCE_GUARD_MODULES) == discovered_modules

0 commit comments

Comments
 (0)