diff --git a/tests/fixtures/sample_type_aliases.py b/tests/fixtures/sample_type_aliases.py index b4e5acd..d471c48 100644 --- a/tests/fixtures/sample_type_aliases.py +++ b/tests/fixtures/sample_type_aliases.py @@ -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. diff --git a/tests/test_ast_parser.py b/tests/test_ast_parser.py index e254357..0182c32 100644 --- a/tests/test_ast_parser.py +++ b/tests/test_ast_parser.py @@ -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 = """