Skip to content

Commit

Permalink
Add test for v1/v2 Annotated discrepancy (#6926)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbordum committed Jul 28, 2023
1 parent e67f39e commit e8091c4
Showing 1 changed file with 11 additions and 0 deletions.
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}

0 comments on commit e8091c4

Please sign in to comment.