MCPcopy Index your code
hub / github.com/python/cpython / test_helper_astuple_nested

Method test_helper_astuple_nested

Lib/test/test_dataclasses/__init__.py:1854–1868  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1852 self.assertEqual(c.y, [])
1853
1854 def test_helper_astuple_nested(self):
1855 @dataclass
1856 class UserId:
1857 token: int
1858 group: int
1859 @dataclass
1860 class User:
1861 name: str
1862 id: UserId
1863 u = User('Joe', UserId(123, 1))
1864 t = astuple(u)
1865 self.assertEqual(t, ('Joe', (123, 1)))
1866 self.assertIsNot(astuple(u), astuple(u))
1867 u.id.group = 2
1868 self.assertEqual(astuple(u), ('Joe', (123, 2)))
1869
1870 def test_helper_astuple_builtin_containers(self):
1871 @dataclass

Callers

nothing calls this directly

Calls 5

assertEqualMethod · 0.95
assertIsNotMethod · 0.95
UserIdClass · 0.85
astupleFunction · 0.85
UserClass · 0.70

Tested by

no test coverage detected