Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions auto_type_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def _to_mod(fname: str, roots: tuple[str, ...]) -> str:
relative.removesuffix('.py')
.replace('/', '.')
.replace('\\', '.')
.removesuffix('.__init__')
)
else:
raise AssertionError(f'{fname=} not found in {roots=}')
Expand Down
6 changes: 6 additions & 0 deletions tests/auto_type_annotate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def test_to_mod_src_layout():
assert _to_mod('bar.py', ('.', 'src')) == 'bar'


def test_to_mod_init_files():
assert _to_mod('a/__init__.py', ('.',)) == 'a'
assert _to_mod('a/__init__b.py', ('.',)) == 'a.__init__b'
assert _to_mod('a/__init__b/c.py', ('.',)) == 'a.__init__b.c'


def _find_untyped(s):
visitor = FindUntyped()
visitor.visit_module(_MOD, ast.parse(s))
Expand Down