@@ -1222,10 +1222,9 @@ class Model:
1222
1222
val .validate_assignment (m , 'x' , 'abc' )
1223
1223
1224
1224
1225
+ @pytest .mark .skipif (sys .version_info < (3 , 10 ), reason = 'slots are only supported for dataclasses in Python > 3.10' )
1225
1226
def test_dataclass_slots_field_before_validator ():
1226
- kwargs = {'slots' : True }
1227
-
1228
- @dataclasses .dataclass (** kwargs )
1227
+ @dataclasses .dataclass (slots = True )
1229
1228
class Foo :
1230
1229
a : int
1231
1230
b : str
@@ -1256,10 +1255,9 @@ def validate_b(cls, v: bytes, info: core_schema.FieldValidationInfo) -> bytes:
1256
1255
assert dataclasses .asdict (foo ) == {'a' : 1 , 'b' : 'hello world!' }
1257
1256
1258
1257
1258
+ @pytest .mark .skipif (sys .version_info < (3 , 10 ), reason = 'slots are only supported for dataclasses in Python > 3.10' )
1259
1259
def test_dataclass_slots_field_after_validator ():
1260
- kwargs = {'slots' : True }
1261
-
1262
- @dataclasses .dataclass (** kwargs )
1260
+ @dataclasses .dataclass (slots = True )
1263
1261
class Foo :
1264
1262
a : int
1265
1263
b : str
@@ -1349,6 +1347,7 @@ class DuplicateDifferentSlots:
1349
1347
),
1350
1348
],
1351
1349
)
1350
+ @pytest .mark .skipif (sys .version_info < (3 , 10 ), reason = 'slots are only supported for dataclasses in Python > 3.10' )
1352
1351
def test_slots_dataclass_subclass (revalidate_instances , input_value , expected ):
1353
1352
schema = core_schema .dataclass_schema (
1354
1353
FooDataclassSlots ,
0 commit comments