Hypothesis integration
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading the referenced returns/contrib/hypothesis/laws.py and compare it with the existing typeclass and mypy checks in this project. Define the proposed check_typeclass strategy and its allow_instances, allow_protocols, and allow_unknown options, then verify supported cases produce valid return types and unsupported cases produce NotImplementedError.
Written by the indexing model from the issue text.
Description
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) -> strmust producestrfor allinstance,protocol, and supported types and it must produceNotImplementedErrorfor types that are not supported- Looks like
check_typeclassmust haveallow_instances,allow_protocols,allow_unknownkwboolarguments 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?
- Dominant language
- Python
- Stars
- 730
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dry-python/classes
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dry-python/classes#496 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
dry-python/classes#494 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
dry-python/classes#492 · 2 comments ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dry-python/classes#481 · 5 comments · 4 reactions ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
dry-python/classes#386 ·
All issues in dry-python/classes
Similar issues
-
pydanty:is-working
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pydantic/pydantic-ai#8843 ·
Maintainers usually reply within 1 day
-
breaking change enhancement server
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sktime/sktime#11310 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day