mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-116647: Fix recursive child in dataclasses (#116790)
This commit is contained in:
parent
3cac2af5ec
commit
75935746be
3 changed files with 13 additions and 1 deletions
|
@ -2471,6 +2471,15 @@ class TestRepr(unittest.TestCase):
|
|||
|
||||
|
||||
class TestEq(unittest.TestCase):
|
||||
def test_recursive_eq(self):
|
||||
# Test a class with recursive child
|
||||
@dataclass
|
||||
class C:
|
||||
recursive: object = ...
|
||||
c = C()
|
||||
c.recursive = c
|
||||
self.assertEqual(c, c)
|
||||
|
||||
def test_no_eq(self):
|
||||
# Test a class with no __eq__ and eq=False.
|
||||
@dataclass(eq=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue