2Tests the slots functionality of dataclass added in Python 3.10.
5# Specification: https://docs.python.org/3/library/dataclasses.html#module-contents
7from dataclasses import dataclass
9# This should generate an error because __slots__ is already defined.
10@dataclass(slots=True) # E[DC1]
Expected a ty diagnostic for this line (tag 'DC1')
Expected a ty diagnostic for this line (tag 'DC1')
24 # This should generate an error because "y" is not in slots.
Expected a ty diagnostic for this line
28@dataclass(slots=False)
37 # This should generate an error because "y" is not in slots.
Expected a ty diagnostic for this line
43 __slots__ = ("y", "x")
65# This should generate an error because __slots__ is not defined.
[unresolved-attribute] Class `DC6` has no attribute `__slots__`
68# This should generate an error because __slots__ is not defined.
[unresolved-attribute] Object of type `DC6` has no attribute `__slots__`