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

Method test_simple

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

Source from the content-addressed store, hash-verified

4352
4353class TestMakeDataclass(unittest.TestCase):
4354 def test_simple(self):
4355 C = make_dataclass('C',
4356 [('x', int),
4357 ('y', int, field(default=5))],
4358 namespace={'add_one': lambda self: self.x + 1})
4359 c = C(10)
4360 self.assertEqual((c.x, c.y), (10, 5))
4361 self.assertEqual(c.add_one(), 11)
4362
4363
4364 def test_no_mutate_namespace(self):

Callers

nothing calls this directly

Calls 4

make_dataclassFunction · 0.85
fieldFunction · 0.85
CClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected