MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_simple

Method test_simple

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

Source from the content-addressed store, hash-verified

4355
4356class TestMakeDataclass(unittest.TestCase):
4357 def test_simple(self):
4358 C = make_dataclass('C',
4359 [('x', int),
4360 ('y', int, field(default=5))],
4361 namespace={'add_one': lambda self: self.x + 1})
4362 c = C(10)
4363 self.assertEqual((c.x, c.y), (10, 5))
4364 self.assertEqual(c.add_one(), 11)
4365
4366
4367 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