We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 883363f commit 1c8f7b9Copy full SHA for 1c8f7b9
Lib/test/test_dataclasses/__init__.py
@@ -3076,6 +3076,20 @@ class C:
3076
with self.assertRaises(FrozenInstanceError):
3077
del c.i
3078
3079
+ def test_frozen_slotted(self):
3080
+ # See https://github.com/python/cpython/pull/144021
3081
+ @dataclass(frozen=True, slots=True)
3082
+ class C:
3083
+ pass
3084
+
3085
+ c = C()
3086
+ # Mutating not defined fields must raise FrozenInstanceError.
3087
+ with self.assertRaises(FrozenInstanceError):
3088
+ c.any_field = 5
3089
3090
3091
+ del c.any_field
3092
3093
def test_inherit(self):
3094
@dataclass(frozen=True)
3095
class C:
0 commit comments