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

Method test_init_calls_set

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

Source from the content-addressed store, hash-verified

4077 self.assertEqual(D.__set_name__.call_count, 1)
4078
4079 def test_init_calls_set(self):
4080 class D:
4081 pass
4082
4083 D.__set__ = Mock()
4084
4085 @dataclass
4086 class C:
4087 i: D = D()
4088
4089 # Make sure D.__set__ is called.
4090 D.__set__.reset_mock()
4091 c = C(5)
4092 self.assertEqual(D.__set__.call_count, 1)
4093
4094 def test_getting_field_calls_get(self):
4095 class D:

Callers

nothing calls this directly

Calls 4

MockClass · 0.90
CClass · 0.70
reset_mockMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected