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

Method test_inherit

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

Source from the content-addressed store, hash-verified

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