Files
pydantic/tests/mypy/fail3.py
T
dmontagu 6c0f4f31d1 Test mypy integration with pytest (#735)
* Test mypy integration with pytest

* Fix for without deps

* Fix filenames issue

* Remove python run in external-mypy

* Update changes

* Remove external-mypy
2019-08-17 12:59:11 +01:00

23 lines
454 B
Python

"""
Test mypy failure with invalid types.
"""
from typing import Generic, List, TypeVar
from pydantic import BaseModel
from pydantic.generics import GenericModel
T = TypeVar('T')
class Model(BaseModel):
list_of_ints: List[int]
class WrapperModel(GenericModel, Generic[T]):
payload: T
model_instance = Model(list_of_ints=[1])
wrapper_instance = WrapperModel[Model](payload=model_instance)
wrapper_instance.payload.list_of_ints.append('1')