hypothesis
hypothesis copied to clipboard
Hypothesis is a powerful, flexible, and easy to use library for property-based testing.
The Array API has had it's [first spec release `2021.12`](https://data-apis.org/array-api/2021.12/) a while now. The next release will add complex numbers, which would be nice to support in `extra.array_api`. We could...
I noticed that [_global_field_lookup](https://github.com/HypothesisWorks/hypothesis/blob/6d86930cef99b8630a5ffa3008d3eefd09b30421/hypothesis-python/src/hypothesis/extra/django/_fields.py#L72) does not define strategies for some form fields, s.a [UsernameField](https://github.com/django/django/blob/f81032572107846922745b68d5b7191058fdd5f5/django/contrib/auth/forms.py#L72) and [ReadOnlyPasswordHashField](https://github.com/django/django/blob/f81032572107846922745b68d5b7191058fdd5f5/django/contrib/auth/forms.py#L63). This makes the code below raise a [ResolutionFailed](https://github.com/HypothesisWorks/hypothesis/blob/6d86930cef99b8630a5ffa3008d3eefd09b30421/hypothesis-python/src/hypothesis/extra/django/_fields.py#L325) exception: ```python from django.contrib.auth.forms import UserCreationForm...
TODO: - [x] Preliminary support for `integers()` - [x] Apply filters to each sub-strategy of a `st.one_of()`, rather than the top level - [x] AST-based analysis of lambdas - [x]...
This issue was prompted by @pganssle's [fantastic review of #2392 (comment)](https://github.com/HypothesisWorks/hypothesis/pull/2392/#discussion_r407489743): between an expert commentary and my own knowledge that Ireland has a negative DST offset, I wrote a much...
Hypothesis has many features designed to help users *find* bugs - but helping users *understand* bugs is equally important! Our headline feature for that is shrinking, but I think we...
The pattern used by #3396 to leverage `ParamSpec` https://github.com/HypothesisWorks/hypothesis/blob/0738717561e419558a831869ab2b81dd918276aa/hypothesis-python/src/hypothesis/strategies/_internal/core.py#L123-L129 does not actually work with the `typing_extensions` backport: ```python # contents of pspec.py from hypothesis.strategies import composite, DrawFn from typing_extensions import...
Consider the following example: ```python import math from hypothesis.extra.ghostwriter import equivalent def gcd(a: int, b: int) -> int: return math.gcd(a, b) print(equivalent(gcd, math.gcd)) ``` ```python @given(a=st.integers(), b=st.integers(), x=st.nothing(), y=st.nothing()) def...
Add `charset=` argument to restrict `st.characters()` to codepoints representable in that encoding
Reflecting on chardet/chardet#167 made me realise that it may often be useful to restrict generated characters to those valid for a particular encoding. In fact, that's exactly why we exclude...
While working on a tutorial for pycon, I found that a substantial part of my materials was simply explaining what the various strategies do... which is what docstrings are for,...
pytz.tzinfo.localize will raise a NonExistentTimeError or AmbiguousTimeError exception if it can't resolve the current local time due to the change to/from daylight savings time. This is the source for numerous...