gh-116647: Fix recursive child in dataclasses (#116790)

This commit is contained in:
et-repositories 2024-03-19 22:58:40 +08:00 committed by GitHub
parent 3cac2af5ec
commit 75935746be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View file

@ -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)