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 tests/fixtures/sample_type_aliases.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2026 Knitli Inc.
#
# SPDX-License-Identifier: MIT OR Apache-2.0
# ruff: noqa: UP040

"""Sample module with type aliases for testing the AST parser.

Expand Down
13 changes: 13 additions & 0 deletions tests/test_ast_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ def test_annotated_variable(self, parser) -> None:
finally:
file_path.unlink()

def test_annotated_assignment_attribute_target(self, parser) -> None:
"""Ignore annotated assignment to attributes (non-Name targets)."""
content = """
self.x: int = 1
"""
file_path = create_temp_file(content)
try:
result = parser.parse_file(file_path, "test.module")

assert len(result.symbols) == 0
finally:
file_path.unlink()

def test_regular_variable(self, parser) -> None:
"""Extract regular variable."""
content = """
Expand Down
Loading