Feature request: support for pydantic types
See original GitHub issueThank you for the really nice library!
This would be such an awesome feature to have:
from hypothesis_auto import auto_test
from pydantic import BaseModel, ValidationError, validator
class UserModel(BaseModel):
name: str
password1: str
password2: str
@validator('name')
def name_must_contain_space(cls, v):
if ' ' not in v:
raise ValueError('must contain a space')
return v.title()
def create_user(user: UserModel):
print(user)
assert True
print(UserModel(name='samuel colvin', password1='zxcvbn', password2='zxcvbn'))
auto_test(create_user) # Throws `pydantic.ValidationError` :-(
Issue Analytics
- State:
- Created 4 years ago
- Comments:10
Top Results From Across the Web
Pydantic V2 Plan
One of the features people have long requested is the ability to convert data to JSON compliant types while converting a model to...
Read more >Field Types - pydantic
pydantic supports the use of Type[T] to specify that a field may only accept classes (not instances) that are subclasses of T ....
Read more >Flask-Pydantic
Flask extension for integration with Pydantic library. ... parameter type, request attribute name ... Feature requests and pull requests are welcome.
Read more >Features - FastAPI
CORS, GZip, Static Files, Streaming responses. Session and Cookie support. 100% test coverage. 100% type annotated codebase. Pydantic features¶. FastAPI is ...
Read more >Pydantic
Pydantic. @pydantic. Data validation in python using type hints. ... one slide 17% new features in V2 - two slides Then the hard...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
On the pydantic side it was mostly @MrMrRobat finding a way to implement the signature.
Well done, all.
See https://github.com/samuelcolvin/pydantic/issues/1032 - once upstream sets the signature for introspection, Hypothesis will pick it up with our existing features. So there’s nothing for
hypothesis-auto
to do but wait!