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

Method test_post_init_staticmethod

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

Source from the content-addressed store, hash-verified

1080 C()
1081
1082 def test_post_init_staticmethod(self):
1083 flag = False
1084 @dataclass
1085 class C:
1086 x: int
1087 y: int
1088 @staticmethod
1089 def __post_init__():
1090 nonlocal flag
1091 flag = True
1092
1093 self.assertFalse(flag)
1094 c = C(3, 4)
1095 self.assertEqual((c.x, c.y), (3, 4))
1096 self.assertTrue(flag)
1097
1098 def test_post_init_classmethod(self):
1099 @dataclass

Callers

nothing calls this directly

Calls 4

assertFalseMethod · 0.95
assertEqualMethod · 0.95
assertTrueMethod · 0.95
CClass · 0.70

Tested by

no test coverage detected