Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hypothesis integration #234

Open
sobolevn opened this issue Jun 20, 2021 · 2 comments
Open

Hypothesis integration #234

sobolevn opened this issue Jun 20, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@sobolevn
Copy link
Member

sobolevn commented Jun 20, 2021

Right now we don't test classes with hypothesis at all.

But, I have a great idea (at least it seems to me like so) of adding a hypothesis plugin, similar to one we have in returns: https://github.com/dry-python/returns/blob/master/returns/contrib/hypothesis/laws.py

What should it do?

  • check_typeclass(typeclass_instance) will check that for all existing types and protocols some valid return type is produced. For example, @typeclass def some(instance) -> str must produce str for all instance, protocol, and supported types and it must produce NotImplementedError for types that are not supported
  • Looks like check_typeclass must have allow_instances, allow_protocols, allow_unknown kw bool arguments to configure what types we actually need in a resulting strategy

It would be a nice companion to our mypy check.

@Zac-HD do you like it? Maybe you have any other ideas?

@Zac-HD
Copy link

Zac-HD commented Jul 2, 2021

Sounds cool!

My only real suggestion is a terminology note: "hypothesis plugin" usually refers to code that Hypothesis invokes via a setuptools entry point; so maybe call this kind of thing a "hypothesis extension" or "hypothesis integration" or "automatic testing tool"?

@sobolevn
Copy link
Member Author

sobolevn commented Jul 2, 2021

"hypothesis integration"

I like that! Thanks for the suggestion 👍

@sobolevn sobolevn changed the title Hypothesis plugin Hypothesis integration Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants