Skip to content

Commit 566684c

Browse files
hramezaniadriangb
authored andcommitted
add test
1 parent e285d06 commit 566684c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pydantic_core/core_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,6 +3134,7 @@ def dataclass_schema(
31343134
metadata: Any other information you want to include with the schema, not used by pydantic-core
31353135
serialization: Custom serialization schema
31363136
frozen: Whether the dataclass is frozen
3137+
slots: Whether the slots is enabled on dataclass
31373138
"""
31383139
return dict_not_none(
31393140
type='dataclass',

tests/test_schema_functions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ def args(*args, **kwargs):
252252
args(MyModel, {'type': 'int'}),
253253
{'type': 'dataclass', 'schema': {'type': 'int'}, 'cls': MyModel, 'slots': False},
254254
),
255+
(
256+
core_schema.dataclass_schema,
257+
# MyModel should be a dataclass, but I'm being lazy here
258+
args(MyModel, {'type': 'int'}, slots=True),
259+
{'type': 'dataclass', 'schema': {'type': 'int'}, 'cls': MyModel, 'slots': True},
260+
),
255261
]
256262

257263

0 commit comments

Comments
 (0)