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

Method test_inherit

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

Source from the content-addressed store, hash-verified

3077 del c.i
3078
3079 def test_inherit(self):
3080 @dataclass(frozen=True)
3081 class C:
3082 i: int
3083
3084 @dataclass(frozen=True)
3085 class D(C):
3086 j: int
3087
3088 d = D(0, 10)
3089 with self.assertRaises(FrozenInstanceError):
3090 d.i = 5
3091 with self.assertRaises(FrozenInstanceError):
3092 d.j = 6
3093 self.assertEqual(d.i, 0)
3094 self.assertEqual(d.j, 10)
3095
3096 def test_inherit_nonfrozen_from_empty_frozen(self):
3097 @dataclass(frozen=True)

Callers

nothing calls this directly

Calls 3

DClass · 0.70
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected