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

Method test_field_default

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

Source from the content-addressed store, hash-verified

538 C()
539
540 def test_field_default(self):
541 default = object()
542 @dataclass
543 class C:
544 x: object = field(default=default)
545
546 self.assertIs(C.x, default)
547 c = C(10)
548 self.assertEqual(c.x, 10)
549
550 # If we delete the instance attribute, we should then see the
551 # class attribute.
552 del c.x
553 self.assertIs(c.x, default)
554
555 self.assertIs(C().x, default)
556
557 def test_not_in_repr(self):
558 @dataclass

Callers

nothing calls this directly

Calls 3

assertIsMethod · 0.95
assertEqualMethod · 0.95
CClass · 0.70

Tested by

no test coverage detected