Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Aug 1, 2024
1 parent 32a8720 commit 3b2e93d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Lib/test/test_dataclasses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3576,7 +3576,7 @@ class A:
class B(A):
pass

self.assertEqual(B.__slots__, ())
self.assertEqual(B.__slots__, {})
B()

def test_dataclass_derived_generic(self):
Expand All @@ -3585,14 +3585,14 @@ def test_dataclass_derived_generic(self):
@dataclass(slots=True, weakref_slot=True)
class A(typing.Generic[T]):
pass
self.assertEqual(A.__slots__, ('__weakref__',))
self.assertEqual(A.__slots__, {'__weakref__': None})
self.assertTrue(A.__weakref__)
A()

@dataclass(slots=True, weakref_slot=True)
class B[T2]:
pass
self.assertEqual(B.__slots__, ('__weakref__',))
self.assertEqual(B.__slots__, {'__weakref__': None})
self.assertTrue(B.__weakref__)
B()

Expand All @@ -3604,20 +3604,20 @@ class RawBase: ...
@dataclass(slots=True, weakref_slot=True)
class C1(typing.Generic[T], RawBase):
pass
self.assertEqual(C1.__slots__, ())
self.assertEqual(C1.__slots__, {})
self.assertTrue(C1.__weakref__)
C1()
@dataclass(slots=True, weakref_slot=True)
class C2(RawBase, typing.Generic[T]):
pass
self.assertEqual(C2.__slots__, ())
self.assertEqual(C2.__slots__, {})
self.assertTrue(C2.__weakref__)
C2()

@dataclass(slots=True, weakref_slot=True)
class D[T2](RawBase):
pass
self.assertEqual(D.__slots__, ())
self.assertEqual(D.__slots__, {})
self.assertTrue(D.__weakref__)
D()

Expand All @@ -3630,20 +3630,20 @@ class WithSlots:
@dataclass(slots=True, weakref_slot=True)
class E1(WithSlots, Generic[T]):
pass
self.assertEqual(E1.__slots__, ('__weakref__',))
self.assertEqual(E1.__slots__, {'__weakref__': None}))
self.assertTrue(E1.__weakref__)
E1()
@dataclass(slots=True, weakref_slot=True)
class E2(Generic[T], WithSlots):
pass
self.assertEqual(E2.__slots__, ('__weakref__',))
self.assertEqual(E2.__slots__, {'__weakref__': None})
self.assertTrue(E2.__weakref__)
E2()

@dataclass(slots=True, weakref_slot=True)
class F[T2](WithSlots):
pass
self.assertEqual(F.__slots__, ('__weakref__',))
self.assertEqual(F.__slots__, {'__weakref__': None})
self.assertTrue(F.__weakref__)
F()

Expand All @@ -3656,20 +3656,20 @@ class WithWeakrefSlot:
@dataclass(slots=True, weakref_slot=True)
class G1(WithWeakrefSlot, Generic[T]):
pass
self.assertEqual(G1.__slots__, ())
self.assertEqual(G1.__slots__, {})
self.assertTrue(G1.__weakref__)
G1()
@dataclass(slots=True, weakref_slot=True)
class G2(Generic[T], WithWeakrefSlot):
pass
self.assertEqual(G2.__slots__, ())
self.assertEqual(G2.__slots__, {})
self.assertTrue(G2.__weakref__)
G2()

@dataclass(slots=True, weakref_slot=True)
class H[T2](WithWeakrefSlot):
pass
self.assertEqual(H.__slots__, ())
self.assertEqual(H.__slots__, {})
self.assertTrue(H.__weakref__)
H()

Expand All @@ -3680,7 +3680,7 @@ class WithDictSlot:
@dataclass(slots=True)
class A(WithDictSlot): ...

self.assertEqual(A.__slots__, ())
self.assertEqual(A.__slots__, {})
self.assertEqual(A().__dict__, {})
A()

Expand Down

0 comments on commit 3b2e93d

Please sign in to comment.