Skip to content

Commit 605604b

Browse files
committed
✅ Add __pydantic_extra__ for root_model
1 parent 1a326fd commit 605604b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/validators/test_model_root.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,16 @@ def f(input_value: str, info):
125125
"ValidationInfo(config=None, context='call 1', field_name='root')",
126126
"ValidationInfo(config=None, context='assignment call', field_name='root')",
127127
]
128+
129+
130+
def test_extra():
131+
class RootModel:
132+
__slots__ = 'root'
133+
root: int
134+
135+
v = SchemaValidator(core_schema.model_schema(RootModel, core_schema.int_schema(), root_model=True))
136+
137+
m = v.validate_python(1)
138+
139+
with pytest.raises(AttributeError):
140+
m.__pydantic_extra__

0 commit comments

Comments
 (0)