question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: support for pydantic types

See original GitHub issue

Thank 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:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

3reactions
samuelcolvincommented, Jun 29, 2020

On the pydantic side it was mostly @MrMrRobat finding a way to implement the signature.

Well done, all.

3reactions
Zac-HDcommented, Jan 31, 2020

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found