mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
0c18619769
* Add mypy plugin * Make all arguments optional for BaseSettings * Get test coverage up * Add changes * Add type-checking for BaseModel.construct, and checking for from_orm * Fix formatting and linting * Fix the build * Heavy refactor of plugin and mypy tests * Make linting pass * Handle dynamic aliases * Better organize plugin code * Add docs * Add support for error codes * Fix minor docs typo * Rename config settings, add docstrings, and incorporate other feedback * Incorporate feedback * Update docs, remove dataclasses for cython * fix mypy example
21 lines
395 B
Python
21 lines
395 B
Python
"""
|
|
Test mypy failure with missing attribute
|
|
"""
|
|
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.age + 'not integer')
|