mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00
![]() ## Summary Adds some initial tests for class and instance attributes, mostly to document (and discuss) what we want to support eventually. These tests are not exhaustive yet. The idea is to specify the coarse-grained behavior first. Things that we'll eventually want to test: - Interplay with inheritance - Support `Final` in addition to `ClassVar` - Specific tests for `ClassVar`, like making sure that we support things like `x: Annotated[ClassVar[int], "metadata"]` - … or making sure that we raise an error here: ```py class Foo: def __init__(self): self.x: ClassVar[str] = "x" ``` - Add tests for `__new__` in addition to the tests for `__init__` - Add tests that show that we use the union of types if multiple methods define the symbol with different types - Make sure that diagnostics are raised if, e.g., the inferred type of an assignment within a method does not match the declared type in the class body. - https://github.com/astral-sh/ruff/pull/15474#discussion_r1916556284 - Method calls are completely left out for now. - Same for `@property` - … and the descriptor protocol ## Test Plan New Markdown tests Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> |
||
---|---|---|
.. | ||
annotated.md | ||
any.md | ||
literal.md | ||
literal_string.md | ||
never.md | ||
optional.md | ||
starred.md | ||
stdlib_typing_aliases.md | ||
string.md | ||
union.md | ||
unsupported_special_forms.md | ||
unsupported_type_qualifiers.md |