mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
044fd42f4f
* working on parsers * starting parse tests * proper tests for parse * adding parse docs * tweaks and history * add test for datetime direct, fix tests * tweak docs
20 lines
304 B
Python
20 lines
304 B
Python
from pydantic import BaseModel, ValidationError
|
|
|
|
|
|
class Model(BaseModel):
|
|
v: str
|
|
|
|
class Config:
|
|
max_anystr_length = 10
|
|
|
|
|
|
try:
|
|
Model(v='x' * 20)
|
|
except ValidationError as e:
|
|
print(e)
|
|
"""
|
|
error validating input
|
|
v:
|
|
length not in range 0 to 10 (error_type=ValueError track=str)
|
|
"""
|