Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for v1/v2 Annotated discrepancy #6926

Merged
merged 1 commit into from Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/test_annotated.py
Expand Up @@ -287,3 +287,14 @@ class Model(BaseModel):
'title': 'Model',
'type': 'object',
}


def test_model_dump_doesnt_dump_annotated_dunder():
class Model(BaseModel):
one: int

AnnotatedModel = Annotated[Model, ...]

# In Pydantic v1, `AnnotatedModel.dict()` would have returned
# `{'one': 1, '__orig_class__': typing.Annotated[...]}`
assert AnnotatedModel(one=1).model_dump() == {'one': 1}