mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
9ef401839b
* add type hints, fix #372 * fix tests and BaseModel inference * fix #280 * fix dataclasses and docs * more typing * adding hints to fields.py * type **EVERTHING* * fix for 3.6 * small speed ups and some typ checks * correct model.copy * update history
21 lines
379 B
Python
21 lines
379 B
Python
"""
|
|
Test mypy failure with invalid types.
|
|
"""
|
|
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, NoneStr
|
|
|
|
|
|
class Model(BaseModel):
|
|
age: int
|
|
first_name = 'John'
|
|
last_name: NoneStr = None
|
|
signup_ts: Optional[datetime] = None
|
|
list_of_ints: List[int]
|
|
|
|
|
|
m = Model(age=42, list_of_ints=[1, '2', b'3'])
|
|
|
|
print(m.foobar)
|