This PR updates hypothesis from 6.13.1 to 6.112.4.
Changelog
### 6.112.4
```
--------------------
This patch tweaks the paths in ``example(...)`` patches, so that
both ``git apply`` and ``patch`` will work by default.
```
### 6.112.3
```
--------------------
This release refactors internals of :class:`hypothesis.stateful.Bundle` to have a more consistent representation internally.
```
### 6.112.2
```
--------------------
This patch fixes an internal error when the ``__context__``
attribute of a raised exception leads to a cycle (:issue:`4115`).
```
### 6.112.1
```
--------------------
This patch removes a now-incorrect internal assertion about numpy's typing after recent numpy changes (currently only in numpy's nightly release).
```
### 6.112.0
```
--------------------
This release adds support for variable-width bytes in our IR layer (:issue:`3921`), which should mean improved performance anywhere you use :func:`~hypothesis.strategies.binary`. If you maintain an alternative backend as part of our (for now explicitly unstable) :ref:`alternative-backends`, this release changes the ``draw_*`` interface and may be a breaking change for you.
```
### 6.111.2
```
--------------------
This patch contains some internal code cleanup. There is no user-visible change.
```
### 6.111.1
```
--------------------
This patch improves shrinking in cases involving 'slips' from one strategy to another. Highly composite strategies are the most likely to benefit from this change.
This patch also reduces the range of :class:`python:datetime.datetime` generated by :func:`~hypothesis.extra.django.from_model` in order to avoid https://code.djangoproject.com/ticket/35683.
```
### 6.111.0
```
--------------------
:ref:`alternative-backends` can now implement ``.observe_test_case()``
and ``observe_information_message()`` methods, to record backend-specific
metadata and messages in our :doc:`observability output <observability>`
(:issue:`3845` and `hypothesis-crosshair22
<https://github.com/pschanely/hypothesis-crosshair/issues/22>`__).
```
### 6.110.2
```
--------------------
Support ``__default__`` field of :obj:`~python:typing.TypeVar`
and support the same from :pypi:`typing_extensions`
in :func:`~hypothesis.strategies.from_type`.
```
### 6.110.1
```
--------------------
Add better error message for :obj:`!~python:typing.TypeIs` types
in :func:`~hypothesis.strategies.from_type`.
```
### 6.110.0
```
--------------------
Support :obj:`~python:typing.LiteralString`
in :func:`~hypothesis.strategies.from_type`.
```
### 6.109.1
```
--------------------
This patch makes progress towards adding type hints to our internal conjecture engine (:issue:`3074`).
```
### 6.109.0
```
--------------------
This release allows using :obj:`~python:typing.Annotated`
and :obj:`!ReadOnly` types
for :class:`~python:typing.TypedDict` value types
with :func:`~hypothesis.strategies.from_type`.
```
### 6.108.10
```
---------------------
This patch fixes compatibility with :pypi:`attrs==24.1.0 <attrs>`
on the nightly build of CPython, 3.14.0 pre-alpha (:issue:`4067`).
```
### 6.108.9
```
--------------------
This patch removes an assertion which was in fact possible in rare circumstances involving a small number of very large draws.
```
### 6.108.8
```
--------------------
This patch improves our example generation performance by adjusting our internal cache implementation.
```
### 6.108.7
```
--------------------
This patch improves our pretty-printer for unusual numbers.
- Signalling NaNs are now represented by using the :mod:`struct` module
to show the exact value by converting from a hexadecimal integer
- CPython `limits integer-to-string conversions
<https://docs.python.org/3/library/stdtypes.html#integer-string-conversion-length-limitation>`__
to mitigate DDOS attacks. We now use hexadecimal for very large
integers, and include underscore separators for integers with ten
or more digits.
```
### 6.108.6
```
--------------------
This patch improves generation speed in some cases by avoiding pretty-printing overhead for non-failing examples.
```
### 6.108.5
```
--------------------
This patch fixes a rare internal error when using :func:`~hypothesis.strategies.integers` with a high number of examples and certain ``{min, max}_value`` parameters (:pull:`4059`).
```
### 6.108.4
```
--------------------
This patch addresses the issue of hypothesis potentially accessing
mocked ``time.perf_counter`` during test execution (:issue:`4051`).
```
### 6.108.3
```
--------------------
Minor internal-only cleanups to some error-handling and reporting code.
```
### 6.108.2
```
--------------------
This patch disables :func:`hypothesis.target` on alternative
backends where it would not work.
```
### 6.108.1
```
--------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.108.0
```
--------------------
This patch changes most Flaky errors to use an ExceptionGroup, which
makes the representation of these errors easier to understand.
```
### 6.107.0
```
--------------------
The ``alphabet=`` argument to :func:`~hypothesis.strategies.from_regex`
now accepts unions of :func:`~hypothesis.strategies.characters` and
:func:`~hypothesis.strategies.sampled_from` strategies, in addition to
accepting each individually.
This patch also fixes a bug where ``text(...).filter(re.compile(...).match)``
could generate non-matching instances if the regex pattern contained ``|``
(:issue:`4008`).
```
### 6.106.1
```
--------------------
This patch improves our pretty-printer (:issue:`4037`).
It also fixes the codemod for ``HealthCheck.all()`` from
:ref:`version 6.72 <v6.72.0>`, which was instead trying to
fix ``Healthcheck.all()`` - note the lower-case ``c``!
Since our tests had the same typo, it all looked good...
until :issue:`4030`.
```
### 6.106.0
```
--------------------
This release improves support for unions of :pypi:`numpy` dtypes such as
``np.float64 | np.complex128`` in :func:`~hypothesis.strategies.from_type`
and :func:`~hypothesis.extra.numpy.arrays` (:issue:`4041`).
```
### 6.105.2
```
--------------------
This patch improves the reporting of certain flaky errors.
```
### 6.105.1
```
--------------------
This patch iterates on our experimental support for alternative backends (:ref:`alternative-backends`). See :pull:`4029` for details.
```
### 6.105.0
```
--------------------
This release improves support for Django 5.0, and drops support for end-of-life Django versions (< 4.2).
Thanks to Joshua Munn for this contribution.
```
### 6.104.4
```
--------------------
Clean up internal cache implementation.
```
### 6.104.3
```
--------------------
This patch updates our autoformatting tools, improving our code style without any API changes.
```
### 6.104.2
```
--------------------
This patch fixes an issue when realizing symbolics with our experimental :obj:`~hypothesis.settings.backend` setting.
```
### 6.104.1
```
--------------------
Improves internal test coverage.
```
### 6.104.0
```
--------------------
This release adds strategies for Django's ``ModelChoiceField`` and
``ModelMultipleChoiceField`` (:issue:`4010`).
Thanks to Joshua Munn for this contribution.
```
### 6.103.5
```
--------------------
Fixes and reinstates full coverage of internal tests, which was accidentally
disabled in :pull:`3935`.
Closes :issue:`4003`.
```
### 6.103.4
```
--------------------
This release prevents a race condition inside internal cache implementation.
```
### 6.103.3
```
--------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.103.2
```
--------------------
This patch improves our deduplication tracking across all strategies (:pull:`4007`). Hypothesis is now less likely to generate the same input twice.
```
### 6.103.1
```
--------------------
Account for time spent in garbage collection during tests, to avoid
flaky ``DeadlineExceeded`` errors as seen in :issue:`3975`.
Also fixes overcounting of stateful run times,
a minor observability bug dating to :ref:`version 6.98.9 <v6.98.9>`
(:pull:`3890`).
```
### 6.103.0
```
--------------------
This release migrates the shrinker to our new internal representation, called the IR layer (:pull:`3962`). This improves the shrinker's performance in the majority of cases. For example, on the Hypothesis test suite, shrinking is a median of 1.38x faster.
It is possible this release regresses performance while shrinking certain strategies. If you encounter strategies which reliably shrink more slowly than they used to (or shrink slowly at all), please open an issue!
You can read more about the IR layer at :issue:`3921`.
```
### 6.102.6
```
--------------------
This patch fixes one of our shrinking passes getting into a rare ``O(n)`` case instead of ``O(log(n))``.
```
### 6.102.5
```
--------------------
This patch fixes some introspection errors new in Python 3.11.9 and
3.13.0b1, for the Ghostwriter and :func:`~hypothesis.strategies.from_type`.
```
### 6.102.4
```
--------------------
Internal developer documentation, no user-visible changes.
```
### 6.102.3
```
--------------------
This patch improves our shrinking of unique collections, such as :func:`~hypothesis.strategies.dictionaries`,
:func:`~hypothesis.strategies.sets`, and :func:`~hypothesis.strategies.lists` with ``unique=True``.
```
### 6.102.2
```
--------------------
This patch fixes a rare internal error when generating very large elements from strategies (:issue:`3874`).
```
### 6.102.1
```
--------------------
This patch fixes an overly strict internal type assertion.
```
### 6.102.0
```
--------------------
This release improves our support for the :pypi:`annotated-types` iterable
``GroupedMetadata`` protocol. In order to treat the elements "as if they
had been unpacked", if one such element is a :class:`~hypothesis.strategies.SearchStrategy`
we now resolve to that strategy. Previously, we treated this as an unknown
filter predicate.
We expect this to be useful for libraries implementing custom metadata -
instead of requiring downstream integration, they can implement the protocol
and yield a lazily-created strategy. Doing so only if Hypothesis is in
:obj:`sys.modules` gives powerful integration with no runtime overhead
or extra dependencies.
```
### 6.101.0
```
--------------------
The :func:`~hypothesis.extra.django.from_model` function currently
tries to create a strategy for :obj:`~django:django.db.models.AutoField`
fields if they don't have :attr:`~django:django.db.models.Field.auto_created`
set to `True`. The docs say it's supposed to skip all
:obj:`~django:django.db.models.AutoField` fields, so this patch updates
the code to do what the docs say (:issue:`3978`).
```
### 6.100.8
```
--------------------
This patch adds some internal type annotations (:issue:`3074`).
Thanks to Andrew Sansom for his contribution!
```
### 6.100.7
```
--------------------
This patch fixes a rare internal error when using :func:`~hypothesis.strategies.integers` with a high ``max_examples`` setting (:issue:`3974`).
```
### 6.100.6
```
--------------------
This patch improves our internal caching logic. We don't expect it to result in any performance improvements (yet!).
```
### 6.100.5
```
--------------------
This patch turns off a check in :func:`~hypothesis.register_random` for possibly
unreferenced RNG instances on the free-threaded build of CPython 3.13 because
this check has a much higher false positive rate in the free-threaded build
(:issue:`3965`).
Thanks to Nathan Goldbaum for this patch.
```
### 6.100.4
```
--------------------
This patch turns off a warning for functions decorated with
:func:`typing.overload` and then :func:`~hypothesis.strategies.composite`,
although only in that order (:issue:`3970`).
```
### 6.100.3
```
--------------------
This patch fixes a significant slowdown when using the :func:`~hypothesis.stateful.precondition` decorator in some cases, due to expensive repr formatting internally (:issue:`3963`).
```
### 6.100.2
```
--------------------
Explicitly cast :obj:`numpy.finfo.smallest_normal` to builtin `float` in
preparation for the :pypi:`numpy==2.0 <numpy>` release (:issue:`3950`)
```
### 6.100.1
```
--------------------
This patch improve a rare error message for flaky tests (:issue:`3940`).
```
### 6.100.0
```
--------------------
The :func:`~hypothesis.extra.numpy.from_dtype` function no longer generates
``NaT`` ("not-a-time") values for the ``datetime64`` or ``timedelta64`` dtypes
if passed ``allow_nan=False`` (:issue:`3943`).
```
### 6.99.13
```
--------------------
This patch includes the :obj:`~hypothesis.settings.backend` setting in the
``how_generated`` field of our :doc:`observability output <observability>`.
```
### 6.99.12
```
--------------------
If you were running Python 3.13 (currently in alpha) with :pypi:`pytest-xdist`
and then attempted to pretty-print a ``lambda`` functions which was created
using the :func:`eval` builtin, it would have raised an AssertionError.
Now you'll get ``"lambda ...: <unknown>"``, as expected.
```
### 6.99.11
```
--------------------
This release improves an internal invariant.
```
### 6.99.10
```
--------------------
This patch fixes Hypothesis sometimes raising a ``Flaky`` error when generating collections of unique floats containing ``nan``. See :issue:`3926` for more details.
```
### 6.99.9
```
-------------------
This patch continues our work on refactoring the shrinker (:issue:`3921`).
```
### 6.99.8
```
-------------------
This patch continues our work on refactoring shrinker internals (:issue:`3921`).
```
### 6.99.7
```
-------------------
This release resolves :py:exc:`PermissionError` that come from
creating databases on inaccessible paths.
```
### 6.99.6
```
-------------------
This patch starts work on refactoring our shrinker internals. There is no user-visible change.
```
### 6.99.5
```
-------------------
This patch fixes a longstanding performance problem in stateful testing (:issue:`3618`),
where state machines which generated a substantial amount of input for each step would
hit the maximum amount of entropy and then fail with an ``Unsatisfiable`` error.
We now stop taking additional steps when we're approaching the entropy limit,
which neatly resolves the problem without touching unaffected tests.
```
### 6.99.4
```
-------------------
Fix regression caused by using :pep:`696` default in TypeVar with Python 3.13.0a3.
```
### 6.99.3
```
-------------------
This patch further improves the type annotations in :mod:`hypothesis.extra.numpy`.
```
### 6.99.2
```
-------------------
Simplify the type annotation of :func:`~hypothesis.extra.pandas.column` and
:func:`~hypothesis.extra.pandas.columns` by using :pep:`696` to avoid overloading.
```
### 6.99.1
```
-------------------
This patch implements type annotations for :func:`~hypothesis.extra.pandas.column`.
```
### 6.99.0
```
-------------------
This release adds the **experimental and unstable** :obj:`~hypothesis.settings.backend`
setting. See :ref:`alternative-backends` for details.
```
### 6.98.18
```
--------------------
This patch fixes :issue:`3900`, a performance regression for
:func:`~hypothesis.extra.numpy.arrays` due to the interaction of
:ref:`v6.98.12` and :ref:`v6.97.1`.
```
### 6.98.17
```
--------------------
This patch improves the type annotations in :mod:`hypothesis.extra.numpy`,
which makes inferred types more precise for both :pypi:`mypy` and
:pypi:`pyright`, and fixes some strict-mode errors on the latter.
Thanks to Jonathan Plasse for reporting and fixing this in :pull:`3889`!
```
### 6.98.16
```
--------------------
This patch paves the way for future shrinker improvements. There is no user-visible change.
```
### 6.98.15
```
--------------------
This release adds support for the Array API's `2023.12 release
<https://data-apis.org/array-api/2023.12/>`_ via the ``api_version`` argument in
:func:`~hypothesis.extra.array_api.make_strategies_namespace`. The API additions
and modifications in the ``2023.12`` spec do not necessitate any changes in the
Hypothesis strategies, hence there is no distinction between a ``2022.12`` and
``2023.12`` strategies namespace.
```
### 6.98.14
```
--------------------
This patch adjusts the printing of bundle values to correspond
with their names when using stateful testing.
```
### 6.98.13
```
--------------------
This patch implements filter-rewriting for :func:`~hypothesis.strategies.text`
and :func:`~hypothesis.strategies.binary` with the :meth:`~re.Pattern.search`,
:meth:`~re.Pattern.match`, or :meth:`~re.Pattern.fullmatch` method of a
:func:`re.compile`\ d regex.
```
### 6.98.12
```
--------------------
This patch implements filter-rewriting for most length filters on some
additional collection types (:issue:`3795`), and fixes several latent
bugs where unsatisfiable or partially-infeasible rewrites could trigger
internal errors.
```
### 6.98.11
```
--------------------
This patch makes stateful testing somewhat less likely to get stuck
when there are only a few possible rules.
```
### 6.98.10
```
--------------------
This patch :pep:`adds a note <678>` to errors which occur while drawing from
a strategy, to make it easier to tell why your test failed in such cases.
```
### 6.98.9
```
-------------------
This patch ensures that :doc:`observability <observability>` outputs include
an informative repr for :class:`~hypothesis.stateful.RuleBasedStateMachine`
stateful tests, along with more detailed timing information.
```
### 6.98.8
```
-------------------
This patch improves :doc:`the Ghostwriter <ghostwriter>` for binary operators.
```
### 6.98.7
```
-------------------
This patch improves import-detection in :doc:`the Ghostwriter <ghostwriter>`
(:issue:`3884`), particularly for :func:`~hypothesis.strategies.from_type`
and strategies from ``hypothesis.extra.*``.
```
### 6.98.6
```
-------------------
This patch clarifies the documentation on stateful testing (:issue:`3511`).
```
### 6.98.5
```
-------------------
This patch improves argument-to-json conversion for :doc:`observability <observability>`
output. Checking for a ``.to_json()`` method on the object *before* a few other
options like dataclass support allows better user control of the process (:issue:`3880`).
```
### 6.98.4
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.98.3
```
-------------------
This patch fixes an error when generating :doc:`observability <observability>` reports involving large (``n > 1e308``) integers.
```
### 6.98.2
```
-------------------
This patch refactors some internals. There is no user-visible change.
```
### 6.98.1
```
-------------------
This release improves our distribution of generated values for all strategies, by doing a better job of tracking which values we have generated before and avoiding generating them again.
For example, ``st.lists(st.integers())`` previously generated ~5 each of ``[]`` ``[0]`` in 100 examples. In this release, each of ``[]`` and ``[0]`` are generated ~1-2 times each.
```
### 6.98.0
```
-------------------
This release deprecates use of the global random number generator while drawing
from a strategy, because this makes test cases less diverse and prevents us
from reporting minimal counterexamples (:issue:`3810`).
If you see this new warning, you can get a quick fix by using
:func:`~hypothesis.strategies.randoms`; or use more idiomatic strategies
:func:`~hypothesis.strategies.sampled_from`, :func:`~hypothesis.strategies.floats`,
:func:`~hypothesis.strategies.integers`, and so on.
Note that the same problem applies to e.g. ``numpy.random``, but
for performance reasons we only check the stdlib :mod:`random` module -
ignoring even other sources passed to :func:`~hypothesis.register_random`.
```
### 6.97.6
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.97.5
```
-------------------
This patch adds some :doc:`observability information <observability>`
about how many times predicates in :func:`~hypothesis.assume` or
:func:`~hypothesis.stateful.precondition` were satisfied, so that
downstream tools can warn you if some were *never* satisfied by
any test case.
```
### 6.97.4
```
-------------------
This patch improves formatting and adds some cross-references to our docs.
```
### 6.97.3
```
-------------------
Internal test refactoring.
```
### 6.97.2
```
-------------------
This patch slightly changes how we replay examples from
:doc:`the database <database>`: if the behavior of the saved example has
changed, we now keep running the test case instead of aborting at the size
of the saved example. While we know it's not the *same* example, we might
as well continue running the test!
Because we now finish running a few more examples for affected tests, this
might be a slight slowdown - but correspondingly more likely to find a bug.
We've also applied similar tricks to the :ref:`target phase <phases>`, where
they are a pure performance improvement for affected tests.
```
### 6.97.1
```
-------------------
Improves the performance of the :func:`~hypothesis.extra.numpy.arrays`
strategy when generating unique values.
```
### 6.97.0
```
-------------------
Changes the distribution of :func:`~hypothesis.strategies.sampled_from` when
sampling from a :class:`~python:enum.Flag`. Previously, no-flags-set values would
never be generated, and all-flags-set values would be unlikely for large enums.
With this change, the distribution is more uniform in the number of flags set.
```
### 6.96.4
```
-------------------
This patch slightly refactors some internals. There is no user-visible change.
```
### 6.96.3
```
-------------------
This patch fixes a spurious warning about slow imports when ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY`` was set.
```
### 6.96.2
```
-------------------
This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
```
### 6.96.1
```
-------------------
Fix a spurious warning seen when running pytest's test
suite, caused by never realizing we got out of
initialization due to imbalanced hook calls.
```
### 6.96.0
```
-------------------
Warns when constructing a `repr` that is overly long. This can
happen by accident if stringifying arbitrary strategies, and
is expensive in time and memory. The associated deferring of
these long strings in :func:`~hypothesis.strategies.sampled_from`
should also lead to improved performance.
```
### 6.95.0
```
-------------------
This release adds the ability to pass any object to :func:`~hypothesis.note`, instead of just strings. The pretty-printed representation of the object will be used.
See also :issue:`3843`.
```
### 6.94.0
```
-------------------
This release avoids creating a ``.hypothesis`` directory when using
:func:`~hypothesis.strategies.register_type_strategy` (:issue:`3836`),
and adds warnings for plugins which do so by other means or have
other unintended side-effects.
```
### 6.93.2
```
-------------------
This patch improves :doc:`observability <observability>` reports by moving
timing information from ``metadata`` to a new ``timing`` key, and supporting
conversion of additional argument types to json rather than string reprs
via a ``.to_json()`` method (including e.g. Pandas dataframes).
Additionally, the :obj:`~hypothesis.HealthCheck.too_slow` health check will
now report *which* strategies were slow, e.g. for strategies a, b, c, ...::
count | fraction | slowest draws (seconds)
a | 3 | 65% | -- -- -- 0.357, 2.000
b | 8 | 16% | 0.100, 0.100, 0.100, 0.111, 0.123
c | 3 | 8% | -- -- 0.030, 0.050, 0.200
(skipped 2 rows of fast draws)
```
### 6.93.1
```
-------------------
This patch refactors some internals, continuing our work on supporting alternative backends
(:issue:`3086`). There is no user-visible change.
```
### 6.93.0
```
-------------------
The :func:`~hypothesis.extra.lark.from_lark` strategy now accepts an ``alphabet=``
argument, which is passed through to :func:`~hypothesis.strategies.from_regex`,
so that you can e.g. constrain the generated strings to a particular codec.
In support of this feature, :func:`~hypothesis.strategies.from_regex` will avoid
generating optional parts which do not fit the alphabet. For example,
``from_regex(r"abc|def", alphabet="abcd")`` was previously an error, and will now
generate only ``'abc'``. Cases where there are no valid strings remain an error.
```
### 6.92.9
```
-------------------
This patch refactors some internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
```
### 6.92.8
```
-------------------
This patch adds a :ref:`test statistics <statistics>` event when a generated example is rejected via :func:`assume <hypothesis.assume>`.
This may also help with distinguishing ``gave_up`` examples in :doc:`observability <observability>` (:issue:`3827`).
```
### 6.92.7
```
-------------------
This introduces the rewriting of length filters on some collection strategies (:issue:`3791`).
Thanks to Reagan Lee for implementing this feature!
```
### 6.92.6
```
-------------------
If a test uses :func:`~hypothesis.strategies.sampled_from` on a sequence of
strategies, and raises a ``TypeError``, we now :pep:`add a note <678>` asking
whether you meant to use :func:`~hypothesis.strategies.one_of`.
Thanks to Vince Reuter for suggesting and implementing this hint!
```
### 6.92.5
```
-------------------
This patch registers explicit strategies for a handful of builtin types,
motivated by improved introspection in PyPy 7.3.14 triggering existing
internal warnings.
Thanks to Carl Friedrich Bolz-Tereick for helping us work out what changed!
```
### 6.92.4
```
-------------------
This patch fixes an error when writing :doc:`observability <observability>` reports without a pre-existing ``.hypothesis`` directory.
```
### 6.92.3
```
-------------------
This patch adds a new environment variable ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER``,
which turns on :doc:`observability <observability>` data collection without collecting
code coverage data, which may be faster on Python 3.11 and earlier.
Thanks to Harrison Goldstein for reporting and fixing :issue:`3821`.
```
### 6.92.2
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.92.1
```
-------------------
This patch fixes a bug introduced in :ref:`version 6.92.0 <v6.92.0>`,
where using the :func:`~hypothesis.strategies.data` strategy would fail
to draw a :func:`~python:dataclasses.dataclass` with a
:class:`~python:collections.defaultdict` field. This was due to a bug
in the standard library which `was fixed in 3.12
<https://github.com/python/cpython/pull/32056>`__, so we've vendored the fix.
```
### 6.92.0
```
-------------------
This release adds an experimental :wikipedia:`observability <Observability_(software)>`
mode. :doc:`You can read the docs about it here <observability>`.
```
### 6.91.2
```
-------------------
This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
```
### 6.91.1
```
-------------------
This patch fixes an issue where :func:`~hypothesis.strategies.builds` could not be used with :pypi:`attrs` objects that defined private attributes (i.e. attributes with a leading underscore). See also :issue:`3791`.
This patch also adds support more generally for using :func:`~hypothesis.strategies.builds` with attrs' ``alias`` parameter, which was previously unsupported.
This patch increases the minimum required version of attrs to 22.2.0.
```
### 6.91.0
```
-------------------
This release adds an optional ``payload`` argument to :func:`hypothesis.event`,
so that you can clearly express the difference between the label and the value
of an observation. :ref:`statistics` will still summarize it as a string, but
future observability options can preserve the distinction.
```
### 6.90.1
```
-------------------
This patch supports assigning ``settings = settings(...)`` as a class attribute
on a subclass of a ``.TestCase`` attribute of a :class:`~hypothesis.stateful.RuleBasedStateMachine`.
Previously, this did nothing at all.
.. code-block: python
works as of this release
class TestMyStatefulMachine(MyStatefulMachine.TestCase):
settings = settings(max_examples=10000)
the old way still works, but it's more verbose.
MyStateMachine.TestCase.settings = settings(max_examples=10000)
class TestMyStatefulMachine(MyStatefulMachine.TestCase):
pass
Thanks to Joey Tran for reporting these settings-related edge cases in stateful testing.
```
### 6.90.0
```
-------------------
This release makes it an error to assign ``settings = settings(...)``
as a class attribute on a :class:`~hypothesis.stateful.RuleBasedStateMachine`.
This has never had any effect, and it should be used as a decorator instead:
.. code-block: python
class BadMachine(RuleBasedStateMachine):
"""This doesn't do anything, and is now an error!"""
settings = settings(derandomize=True)
settings(derandomize=True)
class GoodMachine(RuleBasedStateMachine):
"""This is the right way to do it :-)"""
```
### 6.89.1
```
-------------------
This patch refactors some internals. There is no user-visible change,
but we hope to improve performance and unlock support for alternative
backends such as :pypi:`symbolic execution with crosshair <crosshair-tool>`
in future (:issue:`3086`).
Thanks to Liam DeVoe for this fantastic contribution!
```
### 6.89.0
```
-------------------
This release teaches :func:`~hypothesis.strategies.from_type` to handle constraints
implied by the :pypi:`annotated-types` package - as used by e.g. :pypi:`Pydantic`.
This is usually efficient, but falls back to filtering in a few remaining cases.
Thanks to Viicos for :pull:`3780`!
```
### 6.88.4
```
-------------------
This patch adds a warning when :func:`st.composite <hypothesis.strategies.composite>`
wraps a function annotated as returning a :class:`~hypothesis.strategies.SearchStrategy`,
since this is usually an error (:issue:`3786`). The function should return a value,
and the decorator will convert it to a function which returns a strategy.
```
### 6.88.3
```
-------------------
This patch refactors ``from_type(typing.Tuple)``, allowing
:func:`~hypothesis.strategies.register_type_strategy` to take effect
for tuples instead of being silently ignored (:issue:`3750`).
Thanks to Nick Collins for reporting and extensive work on this issue.
```
### 6.88.2
```
-------------------
This patch improves the speed of the explain phase on python 3.12+, by using the new
:mod:`sys.monitoring` module to collect coverage, instead of :obj:`sys.settrace`.
Thanks to Liam DeVoe for :pull:`3776`!
```
### 6.88.1
```
-------------------
This patch improves :func:`~hypothesis.strategies.register_type_strategy` when used with ``tuple`` subclasses,
by preventing them from being interpreted as generic and provided to strategies like ``st.from_type(Sequence[int])``
(:issue:`3767`).
```
### 6.88.0
```
-------------------
This release allows strategy-generating functions registered with
:func:`~hypothesis.strategies.register_type_strategy` to conditionally not
return a strategy, by returning :data:`NotImplemented` (:issue:`3767`).
```
### 6.87.4
```
-------------------
When :func:`~hypothesis.strategies.randoms` was called with ``use_true_randoms=False``,
calling ``r.sample([], 0)`` would result in an error,
when it should have returned an empty sequence to agree with the normal behaviour of
:func:`random.sample`. This fixes that discrepancy (:issue:`3765`).
```
### 6.87.3
```
-------------------
This patch ensures that the :ref:`hypothesis codemod <codemods>` CLI
will print a warning instead of stopping with an internal error if
one of your files contains invalid syntax (:issue:`3759`).
```
### 6.87.2
```
-------------------
This patch makes some small changes to our NumPy integration to ensure forward
compatibility. Thanks to Mateusz Sokół for :pull:`3761`.
```
### 6.87.1
```
-------------------
Fixes :issue:`3755`, where an internal condition turns out
to be reachable after all.
```
### 6.87.0
```
-------------------
This release deprecates use of :func:`~hypothesis.assume` and ``reject()``
outside of property-based tests, because these functions work by raising a
special exception (:issue:`3743`). It also fixes some type annotations
(:issue:`3753`).
```
### 6.86.2
```
-------------------
Hotfix for :issue:`3747`, a bug in explain mode which is so rare that
we missed it in six months of dogfooding. Thanks to :pypi:`mygrad`
for discovering and promptly reporting this!
```
### 6.86.1
```
-------------------
This patch improves the documentation of :obj:`example(...).xfail() <hypothesis.example.xfail>`
by adding a note about :pep:`614`, similar to :obj:`example(...).via() <hypothesis.example.via>`,
and adds a warning when a strategy generates a test case which seems identical to
one provided by an xfailed example.
```
### 6.86.0
```
-------------------
This release enables the :obj:`~hypothesis.Phase.explain` :ref:`phase <phases>`
by default. We hope it helps you to understand *why* your failing tests have
failed!
```
### 6.85.1
```
-------------------
This patch switches some of our type annotations to use :obj:`typing.Literal`
when only a few specific values are allowed, such as UUID or IP address versions.
```
### 6.85.0
```
-------------------
This release deprecates the old whitelist/blacklist arguments
to :func:`~hypothesis.strategies.characters`, in favor of
include/exclude arguments which more clearly describe their
effects on the set of characters which can be generated.
You can :ref:`use Hypothesis' codemods <codemods>` to automatically
upgrade to the new argument names. In a future version, the old
names will start to raise a ``DeprecationWarning``.
```
### 6.84.3
```
-------------------
This patch automatically disables the :obj:`~hypothesis.HealthCheck.differing_executors`
health check for methods which are also pytest parametrized tests, because
those were mostly false alarms (:issue:`3733`).
```
### 6.84.2
```
-------------------
Building on recent releases, :func:`~hypothesis.strategies.characters`
now accepts _any_ ``codec=``, not just ``"utf-8"`` and ``"ascii"``.
This includes standard codecs from the :mod:`codecs` module and their
aliases, platform specific and user-registered codecs if they are
available, and `python-specific text encodings
<https://docs.python.org/3/library/codecs.html#python-specific-encodings>`__
(but not text transforms or binary transforms).
```
### 6.84.1
```
-------------------
This patch by Reagan Lee makes ``st.text(...).filter(str.isidentifier)``
return an efficient custom strategy (:issue:`3480`).
```
### 6.84.0
```
-------------------
The :func:`~hypothesis.strategies.from_regex` strategy now takes an optional
``alphabet=characters(codec="utf-8")`` argument for unicode strings, like
:func:`~hypothesis.strategies.text`.
This offers more and more-consistent control over the generated strings,
removing previously-hard-coded limitations. With ``fullmatch=False`` and
``alphabet=characters()``, surrogate characters are now possible in leading
and trailing text as well as the body of the match. Negated character classes
such as ``[^A-Z]`` or ``\S`` had a hard-coded exclusion of control characters
and surrogate characters; now they permit anything in ``alphabet=`` consistent
with the class, and control characters are permitted by default.
```
### 6.83.2
```
-------------------
Add a health check that detects if the same test is executed
several times by :ref:`different executors<custom-function-execution>`.
This can lead to difficult-to-debug problems such as :issue:`3446`.
```
### 6.83.1
```
-------------------
Pretty-printing of failing examples can now use functions registered with
:func:`IPython.lib.pretty.for_type` or :func:`~IPython.lib.pretty.for_type_by_name`,
as well as restoring compatibility with ``_repr_pretty_`` callback methods
which were accidentally broken in :ref:`version 6.61.2 <v6.61.2>` (:issue:`3721`).
```
### 6.83.0
```
-------------------
Adds a new ``codec=`` option in :func:`~hypothesis.strategies.characters`, making it
convenient to produce only characters which can be encoded as ``ascii`` or ``utf-8``
bytestrings.
Support for other codecs will be added in a future release.
```
### 6.82.7
```
-------------------
This patch updates our autoformatting tools, improving our code style without any API changes.
```
### 6.82.6
```
-------------------
This patch enables and fixes many more of :pypi:`ruff`\ 's lint rules.
```
### 6.82.5
```
-------------------
Fixes the error message for missing ``[cli]`` extra.
```
### 6.82.4
```
-------------------
This patch ensures that we always close the download connection in
:class:`~hypothesis.database.GitHubArtifactDatabase`.
```
### 6.82.3
```
-------------------
We can now pretty-print combinations of *zero* :class:`enum.Flag`
values, like ``SomeFlag(0)``, which has never worked before.
```
### 6.82.2
```
-------------------
This patch fixes pretty-printing of combinations of :class:`enum.Flag`
values, which was previously an error (:issue:`3709`).
```
### 6.82.1
```
-------------------
Improve shrinking of floats in narrow regions that don't cross an integer
boundary. Closes :issue:`3357`.
```
### 6.82.0
```
-------------------
:func:`~hypothesis.strategies.from_regex` now supports the atomic grouping
(``(?>...)``) and possessive quantifier (``*+``, ``++``, ``?+``, ``{m,n}+``)
syntax `added in Python 3.11 <https://docs.python.org/3/whatsnew/3.11.html#re>`__.
Thanks to Cheuk Ting Ho for implementing this!
```
### 6.81.2
```
-------------------
If the :envvar:`HYPOTHESIS_NO_PLUGINS` environment variable is set, we'll avoid
:ref:`loading plugins <entry-points>` such as `the old Pydantic integration
<https://docs.pydantic.dev/latest/integrations/hypothesis/>`__ or
`HypoFuzz' CLI options <https://hypofuzz.com/docs/quickstart.html#running-hypothesis-fuzz>`__.
This is probably only useful for our own self-tests, but documented in case it might
help narrow down any particularly weird bugs in complex environments.
```
### 6.81.1
```
-------------------
Fixes some lingering issues with inference of recursive types
in :func:`~hypothesis.strategies.from_type`. Closes :issue:`3525`.
```
### 6.81.0
```
-------------------
This release further improves our ``.patch``-file support from
:ref:`version 6.75 <v6.75.0>`, skipping duplicates, tests which use
:func:`~hypothesis.strategies.data` (and don't support
:obj:`example() <hypothesis.example>`\ ), and various broken edge-cases.
Because :pypi:`libCST` has released version 1.0 which uses the native parser
by default, we no longer set the ``LIBCST_PARSER_TYPE=native`` environment
variable. If you are using an older version, you may need to upgrade or
set this envvar for yourself.
```
### 6.80.1
```
-------------------
This patch updates some internal code for selftests.
There is no user-visible change.
```
### 6.80.0
```
-------------------
This release drops support for Python 3.7, `which reached end of life on
2023-06-27 <https://devguide.python.org/versions/>`__.
```
### 6.79.4
```
-------------------
Fixes occasional recursion-limit-exceeded errors when validating
deeply nested strategies. Closes: :issue:`3671`
```
### 6.79.3
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.79.2
```
-------------------
Improve the type rendered in :func:`~hypothesis.strategies.from_type`,
which improves the coverage of Ghostwriter.
```
### 6.79.1
```
-------------------
We now test against Python 3.12 beta in CI, and this patch
fixes some new deprecations.
```
### 6.79.0
```
-------------------
This release changes :func:`~hypothesis.strategies.register_type_strategy`
for compatibility with :pep:`585`: we now store only a single strategy or
resolver function which is used for both the builtin and the ``typing``
module version of each type (:issue:`3635`).
If you previously relied on registering separate strategies for e.g.
``list`` vs ``typing.List``, you may need to use explicit strategies
rather than inferring them from types.
```
### 6.78.3
```
-------------------
This release ensures that Ghostwriter does not use the deprecated aliases
for the ``collections.abc`` classes in ``collections``.
```
### 6.78.2
```
-------------------
This patch improves Ghostwriter's use of qualified names for re-exported
functions and classes, and avoids importing useless :obj:`~typing.TypeVar`\ s.
```
### 6.78.1
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.78.0
```
-------------------
New input validation for :func:`~hypothesis.strategies.recursive`
will raise an error rather than hanging indefinitely if passed
invalid ``max_leaves=`` arguments.
```
### 6.77.0
```
-------------------
:func:`~hypothesis.strategies.from_type` now handles numpy array types:
:obj:`np.typing.ArrayLike <numpy.typing.ArrayLike>`,
:obj:`np.typing.NDArray <numpy.typing.NDArray>`, and parameterized
versions including :class:`np.ndarray[shape, elem_type] <numpy.ndarray>`.
```
### 6.76.0
```
-------------------
Warn in :func:`~hypothesis.strategies.from_type` if the inferred strategy
has no variation (always returning default instances). Also handles numpy
data types by calling :func:`~hypothesis.extra.numpy.from_dtype` on the
corresponding dtype, thus ensuring proper variation for these types.
```
### 6.75.9
```
-------------------
:func:`~hypothesis.strategies.from_type` now works in cases where we use
:func:`~hypothesis.strategies.builds` to create an instance and the constructor
has an argument which would lead to recursion. Previously, this would raise
an error if the argument had a default value.
Thanks to Joachim B Haga for reporting and fixing this problem.
```
### 6.75.8
```
-------------------
In preparation for supporting JAX in :ref:`hypothesis.extra.array_api <array-api>`,
this release supports immutable arrays being generated via :func:`xps.arrays`.
In particular, we internally removed an instance of in-place array modification,
which isn't possible for an immutable array.
```
### 6.75.7
```
-------------------
This release fixes some ``.patch``-file bugs from :ref:`version 6.75 <v6.75.0>`,
and adds automatic support for writing ``hypothesis.example()`` or ``example()``
depending on the current style in your test file - defaulting to the latter.
Note that this feature requires :pypi:`libcst` to be installed, and :pypi:`black`
is strongly recommended. You can ensure you have the dependencies with
``pip install "hypothesis[cli,codemods]"``.
```
### 6.75.6
```
-------------------
This patch continues the work started in :pull:`3651` by adding
:pypi:`ruff` linter rules for :pypi:`pyflakes`, :pypi:`flake8-comprehensions`,
and :pypi:`flake8-implicit-str-concat`.
```
### 6.75.5
```
-------------------
This patch updates our linter stack to use :pypi:`ruff`, and fixes some
previously-ignored lints. Thanks to Christian Clauss for his careful
review and :pull:`3651`!
```
### 6.75.4
```
-------------------
Hypothesis will now record an event for more cases where data is marked
invalid, including for exceeding the internal depth limit.
```
### 6.75.3
```
-------------------
This patch fixes :func:`~hypothesis.strategies.complex_numbers` accidentally
invalidating itself when passed magnitude arguments for 32 and 64-bit widths,
i.e. 16- and 32-bit floats, due to not internally down-casting numbers (:issue:`3573`).
```
### 6.75.2
```
-------------------
Improved the documentation regarding how to use :class:`~hypothesis.database.GitHubArtifactDatabase`
and fixed a bug that occurred in repositories with no existing artifacts.
Thanks to Agustín Covarrubias for this contribution.
```
### 6.75.1
```
-------------------
``hypothesis.errors`` will now raise :py:exc:`AttributeError` when attempting
to access an undefined attribute, rather than returning :py:obj:`None`.
```
### 6.75.0
```
-------------------
Sick of adding :obj:`example() <hypothesis.example>`\ s by hand?
Our Pytest plugin now writes ``.patch`` files to insert them for you, making
`this workflow <https://blog.nelhage.com/post/property-testing-like-afl/>`__
easier than ever before.
Note that you'll need :pypi:`LibCST` (via :ref:`codemods`), and that
:obj:`example().via() <hypothesis.example.via>` requires :pep:`614`
(Python 3.9 or later).
```
### 6.74.1
```
-------------------
This patch provides better error messages for datetime- and timedelta-related
invalid dtypes in our Pandas extra (:issue:`3518`).
Thanks to Nick Muoh at the PyCon Sprints!
```
### 6.74.0
```
-------------------
This release adds support for `nullable pandas dtypes <https://pandas.pydata.org/docs/user_guide/integer_na.html>`__
in :func:`~hypothesis.extra.pandas` (:issue:`3604`).
Thanks to Cheuk Ting Ho for implementing this at the PyCon sprints!
```
### 6.73.1
```
-------------------
This patch updates our minimum Numpy version to 1.16, and restores compatibility
with versions before 1.20, which were broken by a mistake in Hypothesis 6.72.4
(:issue:`3625`).
```
### 6.73.0
```
-------------------
This release upgrades the :ref:`explain phase <phases>` (:issue:`3411`).
* Following the first failure, Hypothesis will (:ref:`usually <phases>`) track which
lines of code were executed by passing and failing examples, and report where they
diverged - with some heuristics to drop unhelpful reports. This is an existing
feature, now upgraded and newly enabled by default.
* After shrinking to a minimal failing example, Hypothesis will try to find parts of
the example -- e.g. separate args to :func:`given() <hypothesis.given>` -- which
can vary freely without changing the result of that minimal failing example.
If the automated experiments run without finding a passing variation, we leave a
comment in the final report:
.. code-block:: python
test_x_divided_by_y(
x=0, or any other generated value
y=0,
)
Just remember that the *lack* of an explanation sometimes just means that Hypothesis
couldn't efficiently find one, not that no explanation (or simpler failing example)
exists.
```
### 6.72.4
```
-------------------
This patch fixes type annotations for the :func:`~hypothesis.extra.numpy.arrays`
strategy. Thanks to Francesc Elies for :pull:`3602`.
```
### 6.72.3
```
-------------------
This patch fixes a bug with :func:`~hypothesis.strategies.from_type()` with ``dict[tuple[int, int], str]``
(:issue:`3527`).
Thanks to Nick Muoh at the PyCon Sprints!
```
### 6.72.2
```
-------------------
This patch refactors our internals to facilitate an upcoming feature.
```
### 6.72.1
```
-------------------
This patch fixes some documentation and prepares for future features.
```
### 6.72.0
```
-------------------
This release deprecates ``Healthcheck.all()``, and :ref:`adds a codemod <codemods>`
to automatically replace it with ``list(Healthcheck)`` (:issue:`3596`).
```
### 6.71.0
```
-------------------
This release adds :class:`~hypothesis.database.GitHubArtifactDatabase`, a new database
backend that allows developers to access the examples found by a Github Actions CI job.
This is particularly useful for workflows that involve continuous fuzzing,
like `HypoFuzz <https://hypofuzz.com/>`__.
Thanks to Agustín Covarrubias for this feature!
```
### 6.70.2
```
-------------------
This patch clarifies the reporting of time spent generating data. A
simple arithmetic mean of the percentage of time spent can be
misleading; reporting the actual time spent avoids misunderstandings.
Thanks to Andrea Reina for reporting and fixing :issue:`3598`!
```
### 6.70.1
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.70.0
```
-------------------
This release adds an optional ``domains=`` parameter to the
:func:`~hypothesis.strategies.emails` strategy, and excludes
the special-use :wikipedia:`.arpa` domain from the default
strategy (:issue:`3567`).
Thanks to Jens Tröger for reporting and fixing this bug!
```
### 6.69.0
```
-------------------
This release turns ``HealthCheck.return_value`` and ``HealthCheck.not_a_test_method``
into unconditional errors. Passing them to ``suppress_health_check=`` is therefore a deprecated no-op.
(:issue:`3568`). Thanks to Reagan Lee for the patch!
Separately, GraalPy can now run and pass most of the hypothesis test suite (:issue:`3587`).
```
### 6.68.3
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.68.2
```
-------------------
This patch fixes missing imports of the :mod:`re` module, when :doc:`ghostwriting <ghostwriter>`
tests which include compiled patterns or regex flags.
Thanks to Jens Heinrich for reporting and promptly fixing this bug!
```
### 6.68.1
```
-------------------
This patch adds some private hooks for use in research on
`Schemathesis <https://github.com/schemathesis/schemathesis>`__
(`see our preprint here <https://arxiv.org/abs/2112.10328>`__).
```
### 6.68.0
```
-------------------
This release adds support for the Array API's `2022.12 release
<https://data-apis.org/array-api/2022.12/>`_ via the ``api_version`` argument in
:func:`~hypothesis.extra.array_api.make_strategies_namespace`. Concretely this
involves complex support in its existing strategies, plus an introduced
:func:`xps.complex_dtypes` strategy.
Additionally this release now treats :ref:`hypothesis.extra.array_api
<array-api>` as stable, meaning breaking changes should only happen with major
releases of Hypothesis.
```
### 6.67.1
```
-------------------
This patch updates our autoformatting tools, improving our code style without any API changes.
```
### 6.67.0
```
-------------------
This release allows for more precise generation of complex numbers using
:func:`~hypothesis.extra.numpy.from_dtype`, by supporting the ``width``,
``min_magnitude``, and ``min_magnitude`` arguments (:issue:`3468`).
Thanks to Felix Divo for this feature!
```
### 6.66.2
```
-------------------
This patch fixes a rare ``RecursionError`` when pretty-printing a multi-line
object without type-specific printer, which was passed to a function which
returned the same object by ``.map()`` or :func:`~hypothesis.strategies.builds`
and thus recursed due to the new pretty reprs in Hypothesis :ref:`v6.65.0`
(:issue:`3560`). Apologies to all those affected.
```
### 6.66.1
```
-------------------
This makes :func:`~hypothesis.extra.numpy.from_dtype` pass through the parameter
``allow_subnormal`` for complex dtypes.
```
### 6.66.0
```
-------------------
This release adds a ``width`` parameter to :func:`~hypothesis.strategies.complex_numbers`,
analogously to :func:`~hypothesis.strategies.floats`.
Thanks to Felix Divo for the new feature!
```
### 6.65.2
```
-------------------
This patch fixes invalid annotations detected for the tests generated by
:doc:`Ghostwritter <ghostwriter>`. It will now correctly generate ``Optional``
types with just one type argument and handle union expressions inside of type
arguments correctly. Additionally, it now supports code with the
``from __future__ import annotations`` marker for Python 3.10 and newer.
```
### 6.65.1
```
-------------------
This release improves the pretty-printing of enums in falsifying examples,
so that they print as their full identifier rather than their repr.
```
### 6.65.0
```
-------------------
Hypothesis now reports some failing inputs by showing the call which constructed
an object, rather than the repr of the object. This can be helpful when the default
repr does not include all relevant details, and will unlock further improvements
in a future version.
For now, we capture calls made via :func:`~hypothesis.strategies.builds`, and via
:ref:`SearchStrategy.map() <mapping>`.
```
### 6.64.0
```
-------------------
The :doc:`Ghostwritter <ghostwriter>` will now include type annotations on tests
for type-annotated code. If you want to force this to happen (or not happen),
pass a boolean to the new ``annotate=`` argument to the Python functions, or
the ``--[no-]annotate`` CLI flag.
Thanks to Nicolas Ganz for this new feature!
```
### 6.63.0
```
-------------------
:func:`~hypothesis.extra.pandas.range_indexes` now accepts a ``name=`` argument,
to generate named :class:`pandas.RangeIndex` objects.
Thanks to Sam Watts for this new feature!
```
### 6.62.1
```
-------------------
This patch tweaks :func:`xps.arrays` internals to improve PyTorch compatibility.
Specifically, ``torch.full()`` does not accept integers as the shape argument
(n.b. technically "size" in torch), but such behaviour is expected in internal
code, so we copy the ``torch`` module and patch in a working ``full()`` function.
```
### 6.62.0
```
-------------------
A classic error when testing is to write a test function that can never fail,
even on inputs that aren't allowed or manually provided. By analogy to the
design pattern of::
pytest.mark.parametrize("arg", [
..., passing examples
pytest.param(..., marks=[pytest.mark.xfail]) expected-failing input
])
we now support :obj:`example(...).xfail() <hypothesis.example.xfail>`, with
the same (optional) ``condition``, ``reason``, and ``raises`` arguments as
``pytest.mark.xfail()``.
Naturally you can also write ``.via(...).xfail(...)``, or ``.xfail(...).via(...)``,
if you wish to note the provenance of expected-failing examples.
```
### 6.61.3
```
-------------------
This patch teaches our enhanced :func:`~typing.get_type_hints` function to
'see through' :obj:`~functools.partial` application, allowing inference
from type hints to work in a few more cases which aren't (yet!) supported
by the standard-library version.
```
### 6.61.2
```
-------------------
This patch improves our pretty-printing of failing examples, including
some refactoring to prepare for exciting future features.
```
### 6.61.1
```
-------------------
This patch brings our :func:`~hypothesis.provisional.domains` and
:func:`~hypothesis.strategies.emails` strategies into compliance with
:rfc:`RFC 5890 §2.3.1 <5890>`: we no longer generate parts-of-domains
where the third and fourth characters are ``--`` ("R-LDH labels"),
though future versions *may* deliberately generate ``xn--`` punycode
labels. Thanks to :pypi:`python-email-validator` for `the report
<https://github.com/JoshData/python-email-validator/issues/92>`__!
```
### 6.61.0
```
-------------------
This release improves our treatment of database keys, which based on (among other things)
the source code of your test function. We now post-process this source to ignore
decorators, comments, trailing whitespace, and blank lines - so that you can add
:obj:`example() <hypothesis.example>`\ s or make some small no-op edits to your code
without preventing replay of any known failing or covering examples.
```
### 6.60.1
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.60.0
```
-------------------
This release improves Hypothesis' ability to resolve forward references in
type annotations. It fixes a bug that prevented
:func:`~hypothesis.strategies.builds` from being used with `pydantic models that
possess updated forward references <https://pydantic-docs.helpmanual.io/usage/postponed_annotations/>`__. See :issue:`3519`.
```
### 6.59.0
```
-------------------
The :obj:`example(...) <hypothesis.example>` decorator now has a ``.via()``
method, which future tools will use to track automatically-added covering
examples (:issue:`3506`).
```
### 6.58.2
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
```
### 6.58.1
```
-------------------
This patch shifts ``hypothesis[lark]`` from depending on the old :pypi:`lark-parser`
package to the new :pypi:`lark` package. There are no code changes in Hypothesis,
it's just that Lark got a new name on PyPI for version 1.0 onwards.
```
### 6.58.0
```
-------------------
:func:`~hypothesis.register_random` has used :mod:`weakref` since :ref:`v6.27.1`,
allowing the :class:`~random.Random`-compatible objects to be garbage-collected when
there are no other references remaining in order to avoid memory leaks.
We now raise an error or emit a warning when this seems likely to happen immediately.
The type annotation of :func:`~hypothesis.register_random` was also widened so that
structural subtypes of :class:`~random.Random` are accepted by static typecheckers.
```
### 6.57.1
```
-------------------
This patch updates some internal type annotations and fixes a formatting bug in the
:obj:`~hypothesis.Phase.explain` phase reporting.
```
### 6.57.0
```
-------------------
Hypothesis now raises an error if you passed a strategy as the ``alphabet=``
argument to :func:`~hypothesis.strategies.text`, and it generated something
which was not a length-one string. This has never been supported, we're just
adding explicit validation to catch cases like `this StackOverflow question
<https://stackoverflow.com/a/74336909/9297601>`__.
```
### 6.56.4
```
-------------------
This patch updates some docs, and depends on :pypi:`exceptiongroup` 1.0.0
final to avoid a bug in the previous version.
```
### 6.56.3
```
-------------------
This patch teaches :func:`~hypothesis.strategies.text` to rewrite a few more
filter predicates (:issue:`3134`). You're unlikely to notice any change.
```
### 6.56.2
```
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy, and fixes some
incorrect examples in the docs for :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes`.
```
### 6.56.1
```
-----
This PR updates hypothesis from 6.13.1 to 6.112.4.
Changelog
### 6.112.4 ``` -------------------- This patch tweaks the paths in ``example(...)`` patches, so that both ``git apply`` and ``patch`` will work by default. ``` ### 6.112.3 ``` -------------------- This release refactors internals of :class:`hypothesis.stateful.Bundle` to have a more consistent representation internally. ``` ### 6.112.2 ``` -------------------- This patch fixes an internal error when the ``__context__`` attribute of a raised exception leads to a cycle (:issue:`4115`). ``` ### 6.112.1 ``` -------------------- This patch removes a now-incorrect internal assertion about numpy's typing after recent numpy changes (currently only in numpy's nightly release). ``` ### 6.112.0 ``` -------------------- This release adds support for variable-width bytes in our IR layer (:issue:`3921`), which should mean improved performance anywhere you use :func:`~hypothesis.strategies.binary`. If you maintain an alternative backend as part of our (for now explicitly unstable) :ref:`alternative-backends`, this release changes the ``draw_*`` interface and may be a breaking change for you. ``` ### 6.111.2 ``` -------------------- This patch contains some internal code cleanup. There is no user-visible change. ``` ### 6.111.1 ``` -------------------- This patch improves shrinking in cases involving 'slips' from one strategy to another. Highly composite strategies are the most likely to benefit from this change. This patch also reduces the range of :class:`python:datetime.datetime` generated by :func:`~hypothesis.extra.django.from_model` in order to avoid https://code.djangoproject.com/ticket/35683. ``` ### 6.111.0 ``` -------------------- :ref:`alternative-backends` can now implement ``.observe_test_case()`` and ``observe_information_message()`` methods, to record backend-specific metadata and messages in our :doc:`observability output <observability>` (:issue:`3845` and `hypothesis-crosshair22 <https://github.com/pschanely/hypothesis-crosshair/issues/22>`__). ``` ### 6.110.2 ``` -------------------- Support ``__default__`` field of :obj:`~python:typing.TypeVar` and support the same from :pypi:`typing_extensions` in :func:`~hypothesis.strategies.from_type`. ``` ### 6.110.1 ``` -------------------- Add better error message for :obj:`!~python:typing.TypeIs` types in :func:`~hypothesis.strategies.from_type`. ``` ### 6.110.0 ``` -------------------- Support :obj:`~python:typing.LiteralString` in :func:`~hypothesis.strategies.from_type`. ``` ### 6.109.1 ``` -------------------- This patch makes progress towards adding type hints to our internal conjecture engine (:issue:`3074`). ``` ### 6.109.0 ``` -------------------- This release allows using :obj:`~python:typing.Annotated` and :obj:`!ReadOnly` types for :class:`~python:typing.TypedDict` value types with :func:`~hypothesis.strategies.from_type`. ``` ### 6.108.10 ``` --------------------- This patch fixes compatibility with :pypi:`attrs==24.1.0 <attrs>` on the nightly build of CPython, 3.14.0 pre-alpha (:issue:`4067`). ``` ### 6.108.9 ``` -------------------- This patch removes an assertion which was in fact possible in rare circumstances involving a small number of very large draws. ``` ### 6.108.8 ``` -------------------- This patch improves our example generation performance by adjusting our internal cache implementation. ``` ### 6.108.7 ``` -------------------- This patch improves our pretty-printer for unusual numbers. - Signalling NaNs are now represented by using the :mod:`struct` module to show the exact value by converting from a hexadecimal integer - CPython `limits integer-to-string conversions <https://docs.python.org/3/library/stdtypes.html#integer-string-conversion-length-limitation>`__ to mitigate DDOS attacks. We now use hexadecimal for very large integers, and include underscore separators for integers with ten or more digits. ``` ### 6.108.6 ``` -------------------- This patch improves generation speed in some cases by avoiding pretty-printing overhead for non-failing examples. ``` ### 6.108.5 ``` -------------------- This patch fixes a rare internal error when using :func:`~hypothesis.strategies.integers` with a high number of examples and certain ``{min, max}_value`` parameters (:pull:`4059`). ``` ### 6.108.4 ``` -------------------- This patch addresses the issue of hypothesis potentially accessing mocked ``time.perf_counter`` during test execution (:issue:`4051`). ``` ### 6.108.3 ``` -------------------- Minor internal-only cleanups to some error-handling and reporting code. ``` ### 6.108.2 ``` -------------------- This patch disables :func:`hypothesis.target` on alternative backends where it would not work. ``` ### 6.108.1 ``` -------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.108.0 ``` -------------------- This patch changes most Flaky errors to use an ExceptionGroup, which makes the representation of these errors easier to understand. ``` ### 6.107.0 ``` -------------------- The ``alphabet=`` argument to :func:`~hypothesis.strategies.from_regex` now accepts unions of :func:`~hypothesis.strategies.characters` and :func:`~hypothesis.strategies.sampled_from` strategies, in addition to accepting each individually. This patch also fixes a bug where ``text(...).filter(re.compile(...).match)`` could generate non-matching instances if the regex pattern contained ``|`` (:issue:`4008`). ``` ### 6.106.1 ``` -------------------- This patch improves our pretty-printer (:issue:`4037`). It also fixes the codemod for ``HealthCheck.all()`` from :ref:`version 6.72 <v6.72.0>`, which was instead trying to fix ``Healthcheck.all()`` - note the lower-case ``c``! Since our tests had the same typo, it all looked good... until :issue:`4030`. ``` ### 6.106.0 ``` -------------------- This release improves support for unions of :pypi:`numpy` dtypes such as ``np.float64 | np.complex128`` in :func:`~hypothesis.strategies.from_type` and :func:`~hypothesis.extra.numpy.arrays` (:issue:`4041`). ``` ### 6.105.2 ``` -------------------- This patch improves the reporting of certain flaky errors. ``` ### 6.105.1 ``` -------------------- This patch iterates on our experimental support for alternative backends (:ref:`alternative-backends`). See :pull:`4029` for details. ``` ### 6.105.0 ``` -------------------- This release improves support for Django 5.0, and drops support for end-of-life Django versions (< 4.2). Thanks to Joshua Munn for this contribution. ``` ### 6.104.4 ``` -------------------- Clean up internal cache implementation. ``` ### 6.104.3 ``` -------------------- This patch updates our autoformatting tools, improving our code style without any API changes. ``` ### 6.104.2 ``` -------------------- This patch fixes an issue when realizing symbolics with our experimental :obj:`~hypothesis.settings.backend` setting. ``` ### 6.104.1 ``` -------------------- Improves internal test coverage. ``` ### 6.104.0 ``` -------------------- This release adds strategies for Django's ``ModelChoiceField`` and ``ModelMultipleChoiceField`` (:issue:`4010`). Thanks to Joshua Munn for this contribution. ``` ### 6.103.5 ``` -------------------- Fixes and reinstates full coverage of internal tests, which was accidentally disabled in :pull:`3935`. Closes :issue:`4003`. ``` ### 6.103.4 ``` -------------------- This release prevents a race condition inside internal cache implementation. ``` ### 6.103.3 ``` -------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.103.2 ``` -------------------- This patch improves our deduplication tracking across all strategies (:pull:`4007`). Hypothesis is now less likely to generate the same input twice. ``` ### 6.103.1 ``` -------------------- Account for time spent in garbage collection during tests, to avoid flaky ``DeadlineExceeded`` errors as seen in :issue:`3975`. Also fixes overcounting of stateful run times, a minor observability bug dating to :ref:`version 6.98.9 <v6.98.9>` (:pull:`3890`). ``` ### 6.103.0 ``` -------------------- This release migrates the shrinker to our new internal representation, called the IR layer (:pull:`3962`). This improves the shrinker's performance in the majority of cases. For example, on the Hypothesis test suite, shrinking is a median of 1.38x faster. It is possible this release regresses performance while shrinking certain strategies. If you encounter strategies which reliably shrink more slowly than they used to (or shrink slowly at all), please open an issue! You can read more about the IR layer at :issue:`3921`. ``` ### 6.102.6 ``` -------------------- This patch fixes one of our shrinking passes getting into a rare ``O(n)`` case instead of ``O(log(n))``. ``` ### 6.102.5 ``` -------------------- This patch fixes some introspection errors new in Python 3.11.9 and 3.13.0b1, for the Ghostwriter and :func:`~hypothesis.strategies.from_type`. ``` ### 6.102.4 ``` -------------------- Internal developer documentation, no user-visible changes. ``` ### 6.102.3 ``` -------------------- This patch improves our shrinking of unique collections, such as :func:`~hypothesis.strategies.dictionaries`, :func:`~hypothesis.strategies.sets`, and :func:`~hypothesis.strategies.lists` with ``unique=True``. ``` ### 6.102.2 ``` -------------------- This patch fixes a rare internal error when generating very large elements from strategies (:issue:`3874`). ``` ### 6.102.1 ``` -------------------- This patch fixes an overly strict internal type assertion. ``` ### 6.102.0 ``` -------------------- This release improves our support for the :pypi:`annotated-types` iterable ``GroupedMetadata`` protocol. In order to treat the elements "as if they had been unpacked", if one such element is a :class:`~hypothesis.strategies.SearchStrategy` we now resolve to that strategy. Previously, we treated this as an unknown filter predicate. We expect this to be useful for libraries implementing custom metadata - instead of requiring downstream integration, they can implement the protocol and yield a lazily-created strategy. Doing so only if Hypothesis is in :obj:`sys.modules` gives powerful integration with no runtime overhead or extra dependencies. ``` ### 6.101.0 ``` -------------------- The :func:`~hypothesis.extra.django.from_model` function currently tries to create a strategy for :obj:`~django:django.db.models.AutoField` fields if they don't have :attr:`~django:django.db.models.Field.auto_created` set to `True`. The docs say it's supposed to skip all :obj:`~django:django.db.models.AutoField` fields, so this patch updates the code to do what the docs say (:issue:`3978`). ``` ### 6.100.8 ``` -------------------- This patch adds some internal type annotations (:issue:`3074`). Thanks to Andrew Sansom for his contribution! ``` ### 6.100.7 ``` -------------------- This patch fixes a rare internal error when using :func:`~hypothesis.strategies.integers` with a high ``max_examples`` setting (:issue:`3974`). ``` ### 6.100.6 ``` -------------------- This patch improves our internal caching logic. We don't expect it to result in any performance improvements (yet!). ``` ### 6.100.5 ``` -------------------- This patch turns off a check in :func:`~hypothesis.register_random` for possibly unreferenced RNG instances on the free-threaded build of CPython 3.13 because this check has a much higher false positive rate in the free-threaded build (:issue:`3965`). Thanks to Nathan Goldbaum for this patch. ``` ### 6.100.4 ``` -------------------- This patch turns off a warning for functions decorated with :func:`typing.overload` and then :func:`~hypothesis.strategies.composite`, although only in that order (:issue:`3970`). ``` ### 6.100.3 ``` -------------------- This patch fixes a significant slowdown when using the :func:`~hypothesis.stateful.precondition` decorator in some cases, due to expensive repr formatting internally (:issue:`3963`). ``` ### 6.100.2 ``` -------------------- Explicitly cast :obj:`numpy.finfo.smallest_normal` to builtin `float` in preparation for the :pypi:`numpy==2.0 <numpy>` release (:issue:`3950`) ``` ### 6.100.1 ``` -------------------- This patch improve a rare error message for flaky tests (:issue:`3940`). ``` ### 6.100.0 ``` -------------------- The :func:`~hypothesis.extra.numpy.from_dtype` function no longer generates ``NaT`` ("not-a-time") values for the ``datetime64`` or ``timedelta64`` dtypes if passed ``allow_nan=False`` (:issue:`3943`). ``` ### 6.99.13 ``` -------------------- This patch includes the :obj:`~hypothesis.settings.backend` setting in the ``how_generated`` field of our :doc:`observability output <observability>`. ``` ### 6.99.12 ``` -------------------- If you were running Python 3.13 (currently in alpha) with :pypi:`pytest-xdist` and then attempted to pretty-print a ``lambda`` functions which was created using the :func:`eval` builtin, it would have raised an AssertionError. Now you'll get ``"lambda ...: <unknown>"``, as expected. ``` ### 6.99.11 ``` -------------------- This release improves an internal invariant. ``` ### 6.99.10 ``` -------------------- This patch fixes Hypothesis sometimes raising a ``Flaky`` error when generating collections of unique floats containing ``nan``. See :issue:`3926` for more details. ``` ### 6.99.9 ``` ------------------- This patch continues our work on refactoring the shrinker (:issue:`3921`). ``` ### 6.99.8 ``` ------------------- This patch continues our work on refactoring shrinker internals (:issue:`3921`). ``` ### 6.99.7 ``` ------------------- This release resolves :py:exc:`PermissionError` that come from creating databases on inaccessible paths. ``` ### 6.99.6 ``` ------------------- This patch starts work on refactoring our shrinker internals. There is no user-visible change. ``` ### 6.99.5 ``` ------------------- This patch fixes a longstanding performance problem in stateful testing (:issue:`3618`), where state machines which generated a substantial amount of input for each step would hit the maximum amount of entropy and then fail with an ``Unsatisfiable`` error. We now stop taking additional steps when we're approaching the entropy limit, which neatly resolves the problem without touching unaffected tests. ``` ### 6.99.4 ``` ------------------- Fix regression caused by using :pep:`696` default in TypeVar with Python 3.13.0a3. ``` ### 6.99.3 ``` ------------------- This patch further improves the type annotations in :mod:`hypothesis.extra.numpy`. ``` ### 6.99.2 ``` ------------------- Simplify the type annotation of :func:`~hypothesis.extra.pandas.column` and :func:`~hypothesis.extra.pandas.columns` by using :pep:`696` to avoid overloading. ``` ### 6.99.1 ``` ------------------- This patch implements type annotations for :func:`~hypothesis.extra.pandas.column`. ``` ### 6.99.0 ``` ------------------- This release adds the **experimental and unstable** :obj:`~hypothesis.settings.backend` setting. See :ref:`alternative-backends` for details. ``` ### 6.98.18 ``` -------------------- This patch fixes :issue:`3900`, a performance regression for :func:`~hypothesis.extra.numpy.arrays` due to the interaction of :ref:`v6.98.12` and :ref:`v6.97.1`. ``` ### 6.98.17 ``` -------------------- This patch improves the type annotations in :mod:`hypothesis.extra.numpy`, which makes inferred types more precise for both :pypi:`mypy` and :pypi:`pyright`, and fixes some strict-mode errors on the latter. Thanks to Jonathan Plasse for reporting and fixing this in :pull:`3889`! ``` ### 6.98.16 ``` -------------------- This patch paves the way for future shrinker improvements. There is no user-visible change. ``` ### 6.98.15 ``` -------------------- This release adds support for the Array API's `2023.12 release <https://data-apis.org/array-api/2023.12/>`_ via the ``api_version`` argument in :func:`~hypothesis.extra.array_api.make_strategies_namespace`. The API additions and modifications in the ``2023.12`` spec do not necessitate any changes in the Hypothesis strategies, hence there is no distinction between a ``2022.12`` and ``2023.12`` strategies namespace. ``` ### 6.98.14 ``` -------------------- This patch adjusts the printing of bundle values to correspond with their names when using stateful testing. ``` ### 6.98.13 ``` -------------------- This patch implements filter-rewriting for :func:`~hypothesis.strategies.text` and :func:`~hypothesis.strategies.binary` with the :meth:`~re.Pattern.search`, :meth:`~re.Pattern.match`, or :meth:`~re.Pattern.fullmatch` method of a :func:`re.compile`\ d regex. ``` ### 6.98.12 ``` -------------------- This patch implements filter-rewriting for most length filters on some additional collection types (:issue:`3795`), and fixes several latent bugs where unsatisfiable or partially-infeasible rewrites could trigger internal errors. ``` ### 6.98.11 ``` -------------------- This patch makes stateful testing somewhat less likely to get stuck when there are only a few possible rules. ``` ### 6.98.10 ``` -------------------- This patch :pep:`adds a note <678>` to errors which occur while drawing from a strategy, to make it easier to tell why your test failed in such cases. ``` ### 6.98.9 ``` ------------------- This patch ensures that :doc:`observability <observability>` outputs include an informative repr for :class:`~hypothesis.stateful.RuleBasedStateMachine` stateful tests, along with more detailed timing information. ``` ### 6.98.8 ``` ------------------- This patch improves :doc:`the Ghostwriter <ghostwriter>` for binary operators. ``` ### 6.98.7 ``` ------------------- This patch improves import-detection in :doc:`the Ghostwriter <ghostwriter>` (:issue:`3884`), particularly for :func:`~hypothesis.strategies.from_type` and strategies from ``hypothesis.extra.*``. ``` ### 6.98.6 ``` ------------------- This patch clarifies the documentation on stateful testing (:issue:`3511`). ``` ### 6.98.5 ``` ------------------- This patch improves argument-to-json conversion for :doc:`observability <observability>` output. Checking for a ``.to_json()`` method on the object *before* a few other options like dataclass support allows better user control of the process (:issue:`3880`). ``` ### 6.98.4 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.98.3 ``` ------------------- This patch fixes an error when generating :doc:`observability <observability>` reports involving large (``n > 1e308``) integers. ``` ### 6.98.2 ``` ------------------- This patch refactors some internals. There is no user-visible change. ``` ### 6.98.1 ``` ------------------- This release improves our distribution of generated values for all strategies, by doing a better job of tracking which values we have generated before and avoiding generating them again. For example, ``st.lists(st.integers())`` previously generated ~5 each of ``[]`` ``[0]`` in 100 examples. In this release, each of ``[]`` and ``[0]`` are generated ~1-2 times each. ``` ### 6.98.0 ``` ------------------- This release deprecates use of the global random number generator while drawing from a strategy, because this makes test cases less diverse and prevents us from reporting minimal counterexamples (:issue:`3810`). If you see this new warning, you can get a quick fix by using :func:`~hypothesis.strategies.randoms`; or use more idiomatic strategies :func:`~hypothesis.strategies.sampled_from`, :func:`~hypothesis.strategies.floats`, :func:`~hypothesis.strategies.integers`, and so on. Note that the same problem applies to e.g. ``numpy.random``, but for performance reasons we only check the stdlib :mod:`random` module - ignoring even other sources passed to :func:`~hypothesis.register_random`. ``` ### 6.97.6 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.97.5 ``` ------------------- This patch adds some :doc:`observability information <observability>` about how many times predicates in :func:`~hypothesis.assume` or :func:`~hypothesis.stateful.precondition` were satisfied, so that downstream tools can warn you if some were *never* satisfied by any test case. ``` ### 6.97.4 ``` ------------------- This patch improves formatting and adds some cross-references to our docs. ``` ### 6.97.3 ``` ------------------- Internal test refactoring. ``` ### 6.97.2 ``` ------------------- This patch slightly changes how we replay examples from :doc:`the database <database>`: if the behavior of the saved example has changed, we now keep running the test case instead of aborting at the size of the saved example. While we know it's not the *same* example, we might as well continue running the test! Because we now finish running a few more examples for affected tests, this might be a slight slowdown - but correspondingly more likely to find a bug. We've also applied similar tricks to the :ref:`target phase <phases>`, where they are a pure performance improvement for affected tests. ``` ### 6.97.1 ``` ------------------- Improves the performance of the :func:`~hypothesis.extra.numpy.arrays` strategy when generating unique values. ``` ### 6.97.0 ``` ------------------- Changes the distribution of :func:`~hypothesis.strategies.sampled_from` when sampling from a :class:`~python:enum.Flag`. Previously, no-flags-set values would never be generated, and all-flags-set values would be unlikely for large enums. With this change, the distribution is more uniform in the number of flags set. ``` ### 6.96.4 ``` ------------------- This patch slightly refactors some internals. There is no user-visible change. ``` ### 6.96.3 ``` ------------------- This patch fixes a spurious warning about slow imports when ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY`` was set. ``` ### 6.96.2 ``` ------------------- This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change. ``` ### 6.96.1 ``` ------------------- Fix a spurious warning seen when running pytest's test suite, caused by never realizing we got out of initialization due to imbalanced hook calls. ``` ### 6.96.0 ``` ------------------- Warns when constructing a `repr` that is overly long. This can happen by accident if stringifying arbitrary strategies, and is expensive in time and memory. The associated deferring of these long strings in :func:`~hypothesis.strategies.sampled_from` should also lead to improved performance. ``` ### 6.95.0 ``` ------------------- This release adds the ability to pass any object to :func:`~hypothesis.note`, instead of just strings. The pretty-printed representation of the object will be used. See also :issue:`3843`. ``` ### 6.94.0 ``` ------------------- This release avoids creating a ``.hypothesis`` directory when using :func:`~hypothesis.strategies.register_type_strategy` (:issue:`3836`), and adds warnings for plugins which do so by other means or have other unintended side-effects. ``` ### 6.93.2 ``` ------------------- This patch improves :doc:`observability <observability>` reports by moving timing information from ``metadata`` to a new ``timing`` key, and supporting conversion of additional argument types to json rather than string reprs via a ``.to_json()`` method (including e.g. Pandas dataframes). Additionally, the :obj:`~hypothesis.HealthCheck.too_slow` health check will now report *which* strategies were slow, e.g. for strategies a, b, c, ...:: count | fraction | slowest draws (seconds) a | 3 | 65% | -- -- -- 0.357, 2.000 b | 8 | 16% | 0.100, 0.100, 0.100, 0.111, 0.123 c | 3 | 8% | -- -- 0.030, 0.050, 0.200 (skipped 2 rows of fast draws) ``` ### 6.93.1 ``` ------------------- This patch refactors some internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change. ``` ### 6.93.0 ``` ------------------- The :func:`~hypothesis.extra.lark.from_lark` strategy now accepts an ``alphabet=`` argument, which is passed through to :func:`~hypothesis.strategies.from_regex`, so that you can e.g. constrain the generated strings to a particular codec. In support of this feature, :func:`~hypothesis.strategies.from_regex` will avoid generating optional parts which do not fit the alphabet. For example, ``from_regex(r"abc|def", alphabet="abcd")`` was previously an error, and will now generate only ``'abc'``. Cases where there are no valid strings remain an error. ``` ### 6.92.9 ``` ------------------- This patch refactors some internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change. ``` ### 6.92.8 ``` ------------------- This patch adds a :ref:`test statistics <statistics>` event when a generated example is rejected via :func:`assume <hypothesis.assume>`. This may also help with distinguishing ``gave_up`` examples in :doc:`observability <observability>` (:issue:`3827`). ``` ### 6.92.7 ``` ------------------- This introduces the rewriting of length filters on some collection strategies (:issue:`3791`). Thanks to Reagan Lee for implementing this feature! ``` ### 6.92.6 ``` ------------------- If a test uses :func:`~hypothesis.strategies.sampled_from` on a sequence of strategies, and raises a ``TypeError``, we now :pep:`add a note <678>` asking whether you meant to use :func:`~hypothesis.strategies.one_of`. Thanks to Vince Reuter for suggesting and implementing this hint! ``` ### 6.92.5 ``` ------------------- This patch registers explicit strategies for a handful of builtin types, motivated by improved introspection in PyPy 7.3.14 triggering existing internal warnings. Thanks to Carl Friedrich Bolz-Tereick for helping us work out what changed! ``` ### 6.92.4 ``` ------------------- This patch fixes an error when writing :doc:`observability <observability>` reports without a pre-existing ``.hypothesis`` directory. ``` ### 6.92.3 ``` ------------------- This patch adds a new environment variable ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER``, which turns on :doc:`observability <observability>` data collection without collecting code coverage data, which may be faster on Python 3.11 and earlier. Thanks to Harrison Goldstein for reporting and fixing :issue:`3821`. ``` ### 6.92.2 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.92.1 ``` ------------------- This patch fixes a bug introduced in :ref:`version 6.92.0 <v6.92.0>`, where using the :func:`~hypothesis.strategies.data` strategy would fail to draw a :func:`~python:dataclasses.dataclass` with a :class:`~python:collections.defaultdict` field. This was due to a bug in the standard library which `was fixed in 3.12 <https://github.com/python/cpython/pull/32056>`__, so we've vendored the fix. ``` ### 6.92.0 ``` ------------------- This release adds an experimental :wikipedia:`observability <Observability_(software)>` mode. :doc:`You can read the docs about it here <observability>`. ``` ### 6.91.2 ``` ------------------- This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change. ``` ### 6.91.1 ``` ------------------- This patch fixes an issue where :func:`~hypothesis.strategies.builds` could not be used with :pypi:`attrs` objects that defined private attributes (i.e. attributes with a leading underscore). See also :issue:`3791`. This patch also adds support more generally for using :func:`~hypothesis.strategies.builds` with attrs' ``alias`` parameter, which was previously unsupported. This patch increases the minimum required version of attrs to 22.2.0. ``` ### 6.91.0 ``` ------------------- This release adds an optional ``payload`` argument to :func:`hypothesis.event`, so that you can clearly express the difference between the label and the value of an observation. :ref:`statistics` will still summarize it as a string, but future observability options can preserve the distinction. ``` ### 6.90.1 ``` ------------------- This patch supports assigning ``settings = settings(...)`` as a class attribute on a subclass of a ``.TestCase`` attribute of a :class:`~hypothesis.stateful.RuleBasedStateMachine`. Previously, this did nothing at all. .. code-block: python works as of this release class TestMyStatefulMachine(MyStatefulMachine.TestCase): settings = settings(max_examples=10000) the old way still works, but it's more verbose. MyStateMachine.TestCase.settings = settings(max_examples=10000) class TestMyStatefulMachine(MyStatefulMachine.TestCase): pass Thanks to Joey Tran for reporting these settings-related edge cases in stateful testing. ``` ### 6.90.0 ``` ------------------- This release makes it an error to assign ``settings = settings(...)`` as a class attribute on a :class:`~hypothesis.stateful.RuleBasedStateMachine`. This has never had any effect, and it should be used as a decorator instead: .. code-block: python class BadMachine(RuleBasedStateMachine): """This doesn't do anything, and is now an error!""" settings = settings(derandomize=True) settings(derandomize=True) class GoodMachine(RuleBasedStateMachine): """This is the right way to do it :-)""" ``` ### 6.89.1 ``` ------------------- This patch refactors some internals. There is no user-visible change, but we hope to improve performance and unlock support for alternative backends such as :pypi:`symbolic execution with crosshair <crosshair-tool>` in future (:issue:`3086`). Thanks to Liam DeVoe for this fantastic contribution! ``` ### 6.89.0 ``` ------------------- This release teaches :func:`~hypothesis.strategies.from_type` to handle constraints implied by the :pypi:`annotated-types` package - as used by e.g. :pypi:`Pydantic`. This is usually efficient, but falls back to filtering in a few remaining cases. Thanks to Viicos for :pull:`3780`! ``` ### 6.88.4 ``` ------------------- This patch adds a warning when :func:`st.composite <hypothesis.strategies.composite>` wraps a function annotated as returning a :class:`~hypothesis.strategies.SearchStrategy`, since this is usually an error (:issue:`3786`). The function should return a value, and the decorator will convert it to a function which returns a strategy. ``` ### 6.88.3 ``` ------------------- This patch refactors ``from_type(typing.Tuple)``, allowing :func:`~hypothesis.strategies.register_type_strategy` to take effect for tuples instead of being silently ignored (:issue:`3750`). Thanks to Nick Collins for reporting and extensive work on this issue. ``` ### 6.88.2 ``` ------------------- This patch improves the speed of the explain phase on python 3.12+, by using the new :mod:`sys.monitoring` module to collect coverage, instead of :obj:`sys.settrace`. Thanks to Liam DeVoe for :pull:`3776`! ``` ### 6.88.1 ``` ------------------- This patch improves :func:`~hypothesis.strategies.register_type_strategy` when used with ``tuple`` subclasses, by preventing them from being interpreted as generic and provided to strategies like ``st.from_type(Sequence[int])`` (:issue:`3767`). ``` ### 6.88.0 ``` ------------------- This release allows strategy-generating functions registered with :func:`~hypothesis.strategies.register_type_strategy` to conditionally not return a strategy, by returning :data:`NotImplemented` (:issue:`3767`). ``` ### 6.87.4 ``` ------------------- When :func:`~hypothesis.strategies.randoms` was called with ``use_true_randoms=False``, calling ``r.sample([], 0)`` would result in an error, when it should have returned an empty sequence to agree with the normal behaviour of :func:`random.sample`. This fixes that discrepancy (:issue:`3765`). ``` ### 6.87.3 ``` ------------------- This patch ensures that the :ref:`hypothesis codemod <codemods>` CLI will print a warning instead of stopping with an internal error if one of your files contains invalid syntax (:issue:`3759`). ``` ### 6.87.2 ``` ------------------- This patch makes some small changes to our NumPy integration to ensure forward compatibility. Thanks to Mateusz Sokół for :pull:`3761`. ``` ### 6.87.1 ``` ------------------- Fixes :issue:`3755`, where an internal condition turns out to be reachable after all. ``` ### 6.87.0 ``` ------------------- This release deprecates use of :func:`~hypothesis.assume` and ``reject()`` outside of property-based tests, because these functions work by raising a special exception (:issue:`3743`). It also fixes some type annotations (:issue:`3753`). ``` ### 6.86.2 ``` ------------------- Hotfix for :issue:`3747`, a bug in explain mode which is so rare that we missed it in six months of dogfooding. Thanks to :pypi:`mygrad` for discovering and promptly reporting this! ``` ### 6.86.1 ``` ------------------- This patch improves the documentation of :obj:`example(...).xfail() <hypothesis.example.xfail>` by adding a note about :pep:`614`, similar to :obj:`example(...).via() <hypothesis.example.via>`, and adds a warning when a strategy generates a test case which seems identical to one provided by an xfailed example. ``` ### 6.86.0 ``` ------------------- This release enables the :obj:`~hypothesis.Phase.explain` :ref:`phase <phases>` by default. We hope it helps you to understand *why* your failing tests have failed! ``` ### 6.85.1 ``` ------------------- This patch switches some of our type annotations to use :obj:`typing.Literal` when only a few specific values are allowed, such as UUID or IP address versions. ``` ### 6.85.0 ``` ------------------- This release deprecates the old whitelist/blacklist arguments to :func:`~hypothesis.strategies.characters`, in favor of include/exclude arguments which more clearly describe their effects on the set of characters which can be generated. You can :ref:`use Hypothesis' codemods <codemods>` to automatically upgrade to the new argument names. In a future version, the old names will start to raise a ``DeprecationWarning``. ``` ### 6.84.3 ``` ------------------- This patch automatically disables the :obj:`~hypothesis.HealthCheck.differing_executors` health check for methods which are also pytest parametrized tests, because those were mostly false alarms (:issue:`3733`). ``` ### 6.84.2 ``` ------------------- Building on recent releases, :func:`~hypothesis.strategies.characters` now accepts _any_ ``codec=``, not just ``"utf-8"`` and ``"ascii"``. This includes standard codecs from the :mod:`codecs` module and their aliases, platform specific and user-registered codecs if they are available, and `python-specific text encodings <https://docs.python.org/3/library/codecs.html#python-specific-encodings>`__ (but not text transforms or binary transforms). ``` ### 6.84.1 ``` ------------------- This patch by Reagan Lee makes ``st.text(...).filter(str.isidentifier)`` return an efficient custom strategy (:issue:`3480`). ``` ### 6.84.0 ``` ------------------- The :func:`~hypothesis.strategies.from_regex` strategy now takes an optional ``alphabet=characters(codec="utf-8")`` argument for unicode strings, like :func:`~hypothesis.strategies.text`. This offers more and more-consistent control over the generated strings, removing previously-hard-coded limitations. With ``fullmatch=False`` and ``alphabet=characters()``, surrogate characters are now possible in leading and trailing text as well as the body of the match. Negated character classes such as ``[^A-Z]`` or ``\S`` had a hard-coded exclusion of control characters and surrogate characters; now they permit anything in ``alphabet=`` consistent with the class, and control characters are permitted by default. ``` ### 6.83.2 ``` ------------------- Add a health check that detects if the same test is executed several times by :ref:`different executors<custom-function-execution>`. This can lead to difficult-to-debug problems such as :issue:`3446`. ``` ### 6.83.1 ``` ------------------- Pretty-printing of failing examples can now use functions registered with :func:`IPython.lib.pretty.for_type` or :func:`~IPython.lib.pretty.for_type_by_name`, as well as restoring compatibility with ``_repr_pretty_`` callback methods which were accidentally broken in :ref:`version 6.61.2 <v6.61.2>` (:issue:`3721`). ``` ### 6.83.0 ``` ------------------- Adds a new ``codec=`` option in :func:`~hypothesis.strategies.characters`, making it convenient to produce only characters which can be encoded as ``ascii`` or ``utf-8`` bytestrings. Support for other codecs will be added in a future release. ``` ### 6.82.7 ``` ------------------- This patch updates our autoformatting tools, improving our code style without any API changes. ``` ### 6.82.6 ``` ------------------- This patch enables and fixes many more of :pypi:`ruff`\ 's lint rules. ``` ### 6.82.5 ``` ------------------- Fixes the error message for missing ``[cli]`` extra. ``` ### 6.82.4 ``` ------------------- This patch ensures that we always close the download connection in :class:`~hypothesis.database.GitHubArtifactDatabase`. ``` ### 6.82.3 ``` ------------------- We can now pretty-print combinations of *zero* :class:`enum.Flag` values, like ``SomeFlag(0)``, which has never worked before. ``` ### 6.82.2 ``` ------------------- This patch fixes pretty-printing of combinations of :class:`enum.Flag` values, which was previously an error (:issue:`3709`). ``` ### 6.82.1 ``` ------------------- Improve shrinking of floats in narrow regions that don't cross an integer boundary. Closes :issue:`3357`. ``` ### 6.82.0 ``` ------------------- :func:`~hypothesis.strategies.from_regex` now supports the atomic grouping (``(?>...)``) and possessive quantifier (``*+``, ``++``, ``?+``, ``{m,n}+``) syntax `added in Python 3.11 <https://docs.python.org/3/whatsnew/3.11.html#re>`__. Thanks to Cheuk Ting Ho for implementing this! ``` ### 6.81.2 ``` ------------------- If the :envvar:`HYPOTHESIS_NO_PLUGINS` environment variable is set, we'll avoid :ref:`loading plugins <entry-points>` such as `the old Pydantic integration <https://docs.pydantic.dev/latest/integrations/hypothesis/>`__ or `HypoFuzz' CLI options <https://hypofuzz.com/docs/quickstart.html#running-hypothesis-fuzz>`__. This is probably only useful for our own self-tests, but documented in case it might help narrow down any particularly weird bugs in complex environments. ``` ### 6.81.1 ``` ------------------- Fixes some lingering issues with inference of recursive types in :func:`~hypothesis.strategies.from_type`. Closes :issue:`3525`. ``` ### 6.81.0 ``` ------------------- This release further improves our ``.patch``-file support from :ref:`version 6.75 <v6.75.0>`, skipping duplicates, tests which use :func:`~hypothesis.strategies.data` (and don't support :obj:`example() <hypothesis.example>`\ ), and various broken edge-cases. Because :pypi:`libCST` has released version 1.0 which uses the native parser by default, we no longer set the ``LIBCST_PARSER_TYPE=native`` environment variable. If you are using an older version, you may need to upgrade or set this envvar for yourself. ``` ### 6.80.1 ``` ------------------- This patch updates some internal code for selftests. There is no user-visible change. ``` ### 6.80.0 ``` ------------------- This release drops support for Python 3.7, `which reached end of life on 2023-06-27 <https://devguide.python.org/versions/>`__. ``` ### 6.79.4 ``` ------------------- Fixes occasional recursion-limit-exceeded errors when validating deeply nested strategies. Closes: :issue:`3671` ``` ### 6.79.3 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.79.2 ``` ------------------- Improve the type rendered in :func:`~hypothesis.strategies.from_type`, which improves the coverage of Ghostwriter. ``` ### 6.79.1 ``` ------------------- We now test against Python 3.12 beta in CI, and this patch fixes some new deprecations. ``` ### 6.79.0 ``` ------------------- This release changes :func:`~hypothesis.strategies.register_type_strategy` for compatibility with :pep:`585`: we now store only a single strategy or resolver function which is used for both the builtin and the ``typing`` module version of each type (:issue:`3635`). If you previously relied on registering separate strategies for e.g. ``list`` vs ``typing.List``, you may need to use explicit strategies rather than inferring them from types. ``` ### 6.78.3 ``` ------------------- This release ensures that Ghostwriter does not use the deprecated aliases for the ``collections.abc`` classes in ``collections``. ``` ### 6.78.2 ``` ------------------- This patch improves Ghostwriter's use of qualified names for re-exported functions and classes, and avoids importing useless :obj:`~typing.TypeVar`\ s. ``` ### 6.78.1 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.78.0 ``` ------------------- New input validation for :func:`~hypothesis.strategies.recursive` will raise an error rather than hanging indefinitely if passed invalid ``max_leaves=`` arguments. ``` ### 6.77.0 ``` ------------------- :func:`~hypothesis.strategies.from_type` now handles numpy array types: :obj:`np.typing.ArrayLike <numpy.typing.ArrayLike>`, :obj:`np.typing.NDArray <numpy.typing.NDArray>`, and parameterized versions including :class:`np.ndarray[shape, elem_type] <numpy.ndarray>`. ``` ### 6.76.0 ``` ------------------- Warn in :func:`~hypothesis.strategies.from_type` if the inferred strategy has no variation (always returning default instances). Also handles numpy data types by calling :func:`~hypothesis.extra.numpy.from_dtype` on the corresponding dtype, thus ensuring proper variation for these types. ``` ### 6.75.9 ``` ------------------- :func:`~hypothesis.strategies.from_type` now works in cases where we use :func:`~hypothesis.strategies.builds` to create an instance and the constructor has an argument which would lead to recursion. Previously, this would raise an error if the argument had a default value. Thanks to Joachim B Haga for reporting and fixing this problem. ``` ### 6.75.8 ``` ------------------- In preparation for supporting JAX in :ref:`hypothesis.extra.array_api <array-api>`, this release supports immutable arrays being generated via :func:`xps.arrays`. In particular, we internally removed an instance of in-place array modification, which isn't possible for an immutable array. ``` ### 6.75.7 ``` ------------------- This release fixes some ``.patch``-file bugs from :ref:`version 6.75 <v6.75.0>`, and adds automatic support for writing ``hypothesis.example()`` or ``example()`` depending on the current style in your test file - defaulting to the latter. Note that this feature requires :pypi:`libcst` to be installed, and :pypi:`black` is strongly recommended. You can ensure you have the dependencies with ``pip install "hypothesis[cli,codemods]"``. ``` ### 6.75.6 ``` ------------------- This patch continues the work started in :pull:`3651` by adding :pypi:`ruff` linter rules for :pypi:`pyflakes`, :pypi:`flake8-comprehensions`, and :pypi:`flake8-implicit-str-concat`. ``` ### 6.75.5 ``` ------------------- This patch updates our linter stack to use :pypi:`ruff`, and fixes some previously-ignored lints. Thanks to Christian Clauss for his careful review and :pull:`3651`! ``` ### 6.75.4 ``` ------------------- Hypothesis will now record an event for more cases where data is marked invalid, including for exceeding the internal depth limit. ``` ### 6.75.3 ``` ------------------- This patch fixes :func:`~hypothesis.strategies.complex_numbers` accidentally invalidating itself when passed magnitude arguments for 32 and 64-bit widths, i.e. 16- and 32-bit floats, due to not internally down-casting numbers (:issue:`3573`). ``` ### 6.75.2 ``` ------------------- Improved the documentation regarding how to use :class:`~hypothesis.database.GitHubArtifactDatabase` and fixed a bug that occurred in repositories with no existing artifacts. Thanks to Agustín Covarrubias for this contribution. ``` ### 6.75.1 ``` ------------------- ``hypothesis.errors`` will now raise :py:exc:`AttributeError` when attempting to access an undefined attribute, rather than returning :py:obj:`None`. ``` ### 6.75.0 ``` ------------------- Sick of adding :obj:`example() <hypothesis.example>`\ s by hand? Our Pytest plugin now writes ``.patch`` files to insert them for you, making `this workflow <https://blog.nelhage.com/post/property-testing-like-afl/>`__ easier than ever before. Note that you'll need :pypi:`LibCST` (via :ref:`codemods`), and that :obj:`example().via() <hypothesis.example.via>` requires :pep:`614` (Python 3.9 or later). ``` ### 6.74.1 ``` ------------------- This patch provides better error messages for datetime- and timedelta-related invalid dtypes in our Pandas extra (:issue:`3518`). Thanks to Nick Muoh at the PyCon Sprints! ``` ### 6.74.0 ``` ------------------- This release adds support for `nullable pandas dtypes <https://pandas.pydata.org/docs/user_guide/integer_na.html>`__ in :func:`~hypothesis.extra.pandas` (:issue:`3604`). Thanks to Cheuk Ting Ho for implementing this at the PyCon sprints! ``` ### 6.73.1 ``` ------------------- This patch updates our minimum Numpy version to 1.16, and restores compatibility with versions before 1.20, which were broken by a mistake in Hypothesis 6.72.4 (:issue:`3625`). ``` ### 6.73.0 ``` ------------------- This release upgrades the :ref:`explain phase <phases>` (:issue:`3411`). * Following the first failure, Hypothesis will (:ref:`usually <phases>`) track which lines of code were executed by passing and failing examples, and report where they diverged - with some heuristics to drop unhelpful reports. This is an existing feature, now upgraded and newly enabled by default. * After shrinking to a minimal failing example, Hypothesis will try to find parts of the example -- e.g. separate args to :func:`given() <hypothesis.given>` -- which can vary freely without changing the result of that minimal failing example. If the automated experiments run without finding a passing variation, we leave a comment in the final report: .. code-block:: python test_x_divided_by_y( x=0, or any other generated value y=0, ) Just remember that the *lack* of an explanation sometimes just means that Hypothesis couldn't efficiently find one, not that no explanation (or simpler failing example) exists. ``` ### 6.72.4 ``` ------------------- This patch fixes type annotations for the :func:`~hypothesis.extra.numpy.arrays` strategy. Thanks to Francesc Elies for :pull:`3602`. ``` ### 6.72.3 ``` ------------------- This patch fixes a bug with :func:`~hypothesis.strategies.from_type()` with ``dict[tuple[int, int], str]`` (:issue:`3527`). Thanks to Nick Muoh at the PyCon Sprints! ``` ### 6.72.2 ``` ------------------- This patch refactors our internals to facilitate an upcoming feature. ``` ### 6.72.1 ``` ------------------- This patch fixes some documentation and prepares for future features. ``` ### 6.72.0 ``` ------------------- This release deprecates ``Healthcheck.all()``, and :ref:`adds a codemod <codemods>` to automatically replace it with ``list(Healthcheck)`` (:issue:`3596`). ``` ### 6.71.0 ``` ------------------- This release adds :class:`~hypothesis.database.GitHubArtifactDatabase`, a new database backend that allows developers to access the examples found by a Github Actions CI job. This is particularly useful for workflows that involve continuous fuzzing, like `HypoFuzz <https://hypofuzz.com/>`__. Thanks to Agustín Covarrubias for this feature! ``` ### 6.70.2 ``` ------------------- This patch clarifies the reporting of time spent generating data. A simple arithmetic mean of the percentage of time spent can be misleading; reporting the actual time spent avoids misunderstandings. Thanks to Andrea Reina for reporting and fixing :issue:`3598`! ``` ### 6.70.1 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.70.0 ``` ------------------- This release adds an optional ``domains=`` parameter to the :func:`~hypothesis.strategies.emails` strategy, and excludes the special-use :wikipedia:`.arpa` domain from the default strategy (:issue:`3567`). Thanks to Jens Tröger for reporting and fixing this bug! ``` ### 6.69.0 ``` ------------------- This release turns ``HealthCheck.return_value`` and ``HealthCheck.not_a_test_method`` into unconditional errors. Passing them to ``suppress_health_check=`` is therefore a deprecated no-op. (:issue:`3568`). Thanks to Reagan Lee for the patch! Separately, GraalPy can now run and pass most of the hypothesis test suite (:issue:`3587`). ``` ### 6.68.3 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.68.2 ``` ------------------- This patch fixes missing imports of the :mod:`re` module, when :doc:`ghostwriting <ghostwriter>` tests which include compiled patterns or regex flags. Thanks to Jens Heinrich for reporting and promptly fixing this bug! ``` ### 6.68.1 ``` ------------------- This patch adds some private hooks for use in research on `Schemathesis <https://github.com/schemathesis/schemathesis>`__ (`see our preprint here <https://arxiv.org/abs/2112.10328>`__). ``` ### 6.68.0 ``` ------------------- This release adds support for the Array API's `2022.12 release <https://data-apis.org/array-api/2022.12/>`_ via the ``api_version`` argument in :func:`~hypothesis.extra.array_api.make_strategies_namespace`. Concretely this involves complex support in its existing strategies, plus an introduced :func:`xps.complex_dtypes` strategy. Additionally this release now treats :ref:`hypothesis.extra.array_api <array-api>` as stable, meaning breaking changes should only happen with major releases of Hypothesis. ``` ### 6.67.1 ``` ------------------- This patch updates our autoformatting tools, improving our code style without any API changes. ``` ### 6.67.0 ``` ------------------- This release allows for more precise generation of complex numbers using :func:`~hypothesis.extra.numpy.from_dtype`, by supporting the ``width``, ``min_magnitude``, and ``min_magnitude`` arguments (:issue:`3468`). Thanks to Felix Divo for this feature! ``` ### 6.66.2 ``` ------------------- This patch fixes a rare ``RecursionError`` when pretty-printing a multi-line object without type-specific printer, which was passed to a function which returned the same object by ``.map()`` or :func:`~hypothesis.strategies.builds` and thus recursed due to the new pretty reprs in Hypothesis :ref:`v6.65.0` (:issue:`3560`). Apologies to all those affected. ``` ### 6.66.1 ``` ------------------- This makes :func:`~hypothesis.extra.numpy.from_dtype` pass through the parameter ``allow_subnormal`` for complex dtypes. ``` ### 6.66.0 ``` ------------------- This release adds a ``width`` parameter to :func:`~hypothesis.strategies.complex_numbers`, analogously to :func:`~hypothesis.strategies.floats`. Thanks to Felix Divo for the new feature! ``` ### 6.65.2 ``` ------------------- This patch fixes invalid annotations detected for the tests generated by :doc:`Ghostwritter <ghostwriter>`. It will now correctly generate ``Optional`` types with just one type argument and handle union expressions inside of type arguments correctly. Additionally, it now supports code with the ``from __future__ import annotations`` marker for Python 3.10 and newer. ``` ### 6.65.1 ``` ------------------- This release improves the pretty-printing of enums in falsifying examples, so that they print as their full identifier rather than their repr. ``` ### 6.65.0 ``` ------------------- Hypothesis now reports some failing inputs by showing the call which constructed an object, rather than the repr of the object. This can be helpful when the default repr does not include all relevant details, and will unlock further improvements in a future version. For now, we capture calls made via :func:`~hypothesis.strategies.builds`, and via :ref:`SearchStrategy.map() <mapping>`. ``` ### 6.64.0 ``` ------------------- The :doc:`Ghostwritter <ghostwriter>` will now include type annotations on tests for type-annotated code. If you want to force this to happen (or not happen), pass a boolean to the new ``annotate=`` argument to the Python functions, or the ``--[no-]annotate`` CLI flag. Thanks to Nicolas Ganz for this new feature! ``` ### 6.63.0 ``` ------------------- :func:`~hypothesis.extra.pandas.range_indexes` now accepts a ``name=`` argument, to generate named :class:`pandas.RangeIndex` objects. Thanks to Sam Watts for this new feature! ``` ### 6.62.1 ``` ------------------- This patch tweaks :func:`xps.arrays` internals to improve PyTorch compatibility. Specifically, ``torch.full()`` does not accept integers as the shape argument (n.b. technically "size" in torch), but such behaviour is expected in internal code, so we copy the ``torch`` module and patch in a working ``full()`` function. ``` ### 6.62.0 ``` ------------------- A classic error when testing is to write a test function that can never fail, even on inputs that aren't allowed or manually provided. By analogy to the design pattern of:: pytest.mark.parametrize("arg", [ ..., passing examples pytest.param(..., marks=[pytest.mark.xfail]) expected-failing input ]) we now support :obj:`example(...).xfail() <hypothesis.example.xfail>`, with the same (optional) ``condition``, ``reason``, and ``raises`` arguments as ``pytest.mark.xfail()``. Naturally you can also write ``.via(...).xfail(...)``, or ``.xfail(...).via(...)``, if you wish to note the provenance of expected-failing examples. ``` ### 6.61.3 ``` ------------------- This patch teaches our enhanced :func:`~typing.get_type_hints` function to 'see through' :obj:`~functools.partial` application, allowing inference from type hints to work in a few more cases which aren't (yet!) supported by the standard-library version. ``` ### 6.61.2 ``` ------------------- This patch improves our pretty-printing of failing examples, including some refactoring to prepare for exciting future features. ``` ### 6.61.1 ``` ------------------- This patch brings our :func:`~hypothesis.provisional.domains` and :func:`~hypothesis.strategies.emails` strategies into compliance with :rfc:`RFC 5890 §2.3.1 <5890>`: we no longer generate parts-of-domains where the third and fourth characters are ``--`` ("R-LDH labels"), though future versions *may* deliberately generate ``xn--`` punycode labels. Thanks to :pypi:`python-email-validator` for `the report <https://github.com/JoshData/python-email-validator/issues/92>`__! ``` ### 6.61.0 ``` ------------------- This release improves our treatment of database keys, which based on (among other things) the source code of your test function. We now post-process this source to ignore decorators, comments, trailing whitespace, and blank lines - so that you can add :obj:`example() <hypothesis.example>`\ s or make some small no-op edits to your code without preventing replay of any known failing or covering examples. ``` ### 6.60.1 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.60.0 ``` ------------------- This release improves Hypothesis' ability to resolve forward references in type annotations. It fixes a bug that prevented :func:`~hypothesis.strategies.builds` from being used with `pydantic models that possess updated forward references <https://pydantic-docs.helpmanual.io/usage/postponed_annotations/>`__. See :issue:`3519`. ``` ### 6.59.0 ``` ------------------- The :obj:`example(...) <hypothesis.example>` decorator now has a ``.via()`` method, which future tools will use to track automatically-added covering examples (:issue:`3506`). ``` ### 6.58.2 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy. ``` ### 6.58.1 ``` ------------------- This patch shifts ``hypothesis[lark]`` from depending on the old :pypi:`lark-parser` package to the new :pypi:`lark` package. There are no code changes in Hypothesis, it's just that Lark got a new name on PyPI for version 1.0 onwards. ``` ### 6.58.0 ``` ------------------- :func:`~hypothesis.register_random` has used :mod:`weakref` since :ref:`v6.27.1`, allowing the :class:`~random.Random`-compatible objects to be garbage-collected when there are no other references remaining in order to avoid memory leaks. We now raise an error or emit a warning when this seems likely to happen immediately. The type annotation of :func:`~hypothesis.register_random` was also widened so that structural subtypes of :class:`~random.Random` are accepted by static typecheckers. ``` ### 6.57.1 ``` ------------------- This patch updates some internal type annotations and fixes a formatting bug in the :obj:`~hypothesis.Phase.explain` phase reporting. ``` ### 6.57.0 ``` ------------------- Hypothesis now raises an error if you passed a strategy as the ``alphabet=`` argument to :func:`~hypothesis.strategies.text`, and it generated something which was not a length-one string. This has never been supported, we're just adding explicit validation to catch cases like `this StackOverflow question <https://stackoverflow.com/a/74336909/9297601>`__. ``` ### 6.56.4 ``` ------------------- This patch updates some docs, and depends on :pypi:`exceptiongroup` 1.0.0 final to avoid a bug in the previous version. ``` ### 6.56.3 ``` ------------------- This patch teaches :func:`~hypothesis.strategies.text` to rewrite a few more filter predicates (:issue:`3134`). You're unlikely to notice any change. ``` ### 6.56.2 ``` ------------------- This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__, which is used by the provisional :func:`~hypothesis.provisional.domains` strategy, and fixes some incorrect examples in the docs for :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes`. ``` ### 6.56.1 ``` -----