Changelog
### 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 patch improves the error message when Hypothesis detects "flush to zero"
mode for floating-point: we now report which package(s) enabled this, which
can make debugging much easier. See :issue:`3458` for details.
```
### 6.56.0
```
-------------------
This release defines ``__bool__()`` on :class:`~hypothesis.strategies.SearchStrategy`.
It always returns ``True``, like before, but also emits a warning to help with
cases where you intended to draw a value (:issue:`3463`).
```
### 6.55.0
```
-------------------
In preparation for `future versions of the Array API standard
<https://data-apis.org/array-api/latest/future_API_evolution.html>`__,
:func:`~hypothesis.extra.array_api.make_strategies_namespace` now accepts an
optional ``api_version`` argument, which determines the version conformed to by
the returned strategies namespace. If ``None``, the version of the passed array
module ``xp`` is inferred.
This release also introduces :func:`xps.real_dtypes`. This is currently
equivalent to the existing :func:`xps.numeric_dtypes` strategy, but exists
because the latter is expected to include complex numbers in the next version of
the standard.
```
### 6.54.6
```
-------------------
If multiple explicit examples (from :obj:`example() <hypothesis.example>`)
raise a Skip exception, for consistency with generated examples we now re-raise
the first instead of collecting them into an ExceptionGroup (:issue:`3453`).
```
### 6.54.5
```
-------------------
This patch updates our autoformatting tools, improving our code style without any API changes.
```
### 6.54.4
```
-------------------
This patch fixes some type annotations for Python 3.9 and earlier (:issue:`3397`),
and teaches :ref:`explain mode <phases>` about certain locations it should not
bother reporting (:issue:`3439`).
```
### 6.54.3
```
-------------------
This patch teaches the Ghostwriter an additional check for function
and class locations that should make it use public APIs more often.
```
### 6.54.2
```
-------------------
This patch fixes our workaround for `a pytest bug where the inner exceptions in
an ExceptionGroup are not displayed <https://github.com/pytest-dev/pytest/issues/9159>`__
(:issue:`3430`).
```
### 6.54.1
```
-------------------
This patch makes ``FailedHealthCheck`` and ``DeadlineExceeded`` exceptions
picklable, for compatibility with Django's parallel test runner (:issue:`3426`).
```
### 6.54.0
```
-------------------
Reporting of :obj:`multiple failing examples <hypothesis.settings.report_multiple_bugs>`
now uses the :pep:`654` `ExceptionGroup <https://docs.python.org/3.11/library/exceptions.html#ExceptionGroup>`__ type, which is provided by the
:pypi:`exceptiongroup` backport on Python 3.10 and earlier (:issue:`3175`).
``hypothesis.errors.MultipleFailures`` is therefore deprecated.
Failing examples and other reports are now stored as :pep:`678` exception notes, which
ensures that they will always appear together with the traceback and other information
about their respective error.
```
### 6.53.0
```
-------------------
:func:`~hypothesis.extra.django.from_field` now supports ``UsernameField``
from :mod:`django.contrib.auth.forms`.
Thanks to Afonso Silva for reporting and working on :issue:`3417`.
```
### 6.52.4
```
-------------------
This patch improves the error message when you pass filenames to the :command:`hypothesis write`
CLI, which takes the name of a module or function (e.g. :command:`hypothesis write gzip` or
:command:`hypothesis write package.some_function` rather than :command:`hypothesis write script.py`).
Thanks to Ed Rogers for implementing this as part of the SciPy 2022 sprints!
```
### 6.52.3
```
-------------------
This patch ensures that the warning for non-interactive ``.example()``
points to your code instead of Hypothesis internals (:issue:`3403`).
Thanks to jameslamb for this fix.
```
### 6.52.2
```
-------------------
This patch makes :func:`~hypothesis.strategies.integers` more likely to
generate boundary values for large two-sided intervals (:issue:`2942`).
```
### 6.52.1
```
-------------------
This patch adds filter rewriting for :func:`math.isfinite`, :func:`math.isinf`, and :func:`math.isnan`
on :func:`~hypothesis.strategies.integers` or :func:`~hypothesis.strategies.floats` (:issue:`2701`).
Thanks to Sam Clamons at the SciPy Sprints!
```
### 6.52.0
```
-------------------
This release adds the ``allow_subnormal`` argument to :func:`~hypothesis.strategies.complex_numbers` by
applying it to each of the real and imaginary parts separately. Closes :issue:`3390`.
Thanks to Evan Tey for this fix.
```
### 6.51.0
```
-------------------
Issue a deprecation warning if a function decorated with
:func:`composite <hypothesis.strategies.composite>`
does not draw any values (:issue:`3384`).
Thanks to Grzegorz Zieba, Rodrigo Girão, and Thomas Ball for
working on this at the EuroPython sprints!
```
### 6.50.1
```
-------------------
This patch improves the error messages in :obj:`example() <hypothesis.example>`
argument validation following the recent release of :ref:`6.49.1 <v6.49.1>`.
```
### 6.50.0
```
-------------------
This release allows :func:`~hypothesis.extra.numpy.from_dtype` to generate
Unicode strings which cannot be encoded in UTF-8, but are valid in Numpy
arrays (which use UTF-32).
This logic will only be used with :pypi:`Numpy` >= 1.19, because earlier
versions have `an issue <https://github.com/numpy/numpy/issues/15363>`__
which led us to revert :ref:`Hypothesis 5.2 <v5.2.0>` last time!
```
### 6.49.1
```
-------------------
This patch fixes some inconsistency between argument handling for
:obj:`example <hypothesis.example>` and :func:`given <hypothesis.given>`
(:issue:`2706 <2706issuecomment-1168363177>`).
```
### 6.49.0
```
-------------------
This release uses :pep:`612` :obj:`python:typing.ParamSpec` (or the
:pypi:`typing_extensions` backport) to express the first-argument-removing
behaviour of :func:`st.composite <hypothesis.strategies.composite>`
and signature-preservation of :func:`~hypothesis.strategies.functions`
to IDEs, editor plugins, and static type checkers such as :pypi:`mypy`.
```
### 6.48.3
```
-------------------
:func:`hypothesis.event` now works for hashable objects which do not
support weakrefs, such as integers and tuples.
```
### 6.48.2
```
-------------------
This patch tidies up some internal introspection logic, which will improve
support for positional-only arguments in a future release (:issue:`2706`).
```
### 6.48.1
```
-------------------
This release automatically rewrites some simple filters, such as
``floats().filter(lambda x: x >= 10)`` to the more efficient
``floats(min_value=10)``, based on the AST of the predicate.
We continue to recommend using the efficient form directly wherever
possible, but this should be useful for e.g. :pypi:`pandera` "``Checks``"
where you already have a simple predicate and translating manually
is really annoying. See :issue:`2701` for details.
```
### 6.48.0
```
-------------------
This release raises :class:`~unittest.SkipTest` for tests which never executed any
examples, for example because the :obj:`~hypothesis.settings.phases` setting
excluded the :obj:`~hypothesis.Phase.explicit`, :obj:`~hypothesis.Phase.reuse`,
and :obj:`~hypothesis.Phase.generate` phases. This helps to avoid cases where
broken tests appear to pass, because they didn't actually execute (:issue:`3328`).
```
### 6.47.5
```
-------------------
This patch fixes type annotations that had caused the signature of
:func:`given <hypothesis.given>` to be partially-unknown to type-checkers for Python
versions before 3.10.
```
### 6.47.4
```
-------------------
This patch fixes :func:`~hypothesis.strategies.from_type` on Python 3.11,
following `python/cpython93754 <https://github.com/python/cpython/pull/93754/>`__.
```
### 6.47.3
```
-------------------
This patch makes the :obj:`~hypothesis.HealthCheck.too_slow` health check more
consistent with long :obj:`~hypothesis.settings.deadline` tests (:issue:`3367`)
and fixes an install issue under :pypi:`pipenv` which was introduced in
:ref:`Hypothesis 6.47.2 <v6.47.2>` (:issue:`3374`).
```
### 6.47.2
```
-------------------
We now use the :pep:`654` `ExceptionGroup <https://docs.python.org/3.11/library/exceptions.html#ExceptionGroup>`__
type - provided by the :pypi:`exceptiongroup` backport on older Pythons -
to ensure that if multiple errors are raised in teardown, they will all propagate.
```
### 6.47.1
```
-------------------
Our pretty-printer no longer sorts dictionary keys, since iteration order is
stable in Python 3.7+ and this can affect reproducing examples (:issue:`3370`).
This PR was kindly supported by `Ordina Pythoneers
<https://www.ordina.nl/vakgebieden/python/>`__.
```
### 6.47.0
```
-------------------
The :doc:`Ghostwritter <ghostwriter>` can now write tests for
:obj:`classmethod <classmethod>` or :obj:`staticmethod <staticmethod>`
methods, in addition to the existing support for functions and other callables
(:issue:`3318`). Thanks to Cheuk Ting Ho for the patch.
```
### 6.46.11
```
--------------------
Mention :func:`hypothesis.strategies.timezones`
in the documentation of :func:`hypothesis.strategies.datetimes` for completeness.
Thanks to George Macon for this addition.
```
### 6.46.10
```
--------------------
This release contains some small improvements to our documentation.
Thanks to Felix Divo for his contribution!
```
### 6.46.9
```
-------------------
This patch by Adrian Garcia Badaracco adds type annotations
to some private internals (:issue:`3074`).
```
### 6.46.8
```
-------------------
This patch by Phillip Schanely makes changes to the
:func:`~hypothesis.strategies.floats` strategy when ``min_value`` or ``max_value`` is
present.
Hypothesis will now be capable of generating every representable value in the bounds.
You may notice that hypothesis is more likely to test values near boundaries, and values
that are very close to zero.
These changes also support future integrations with symbolic execution tools and fuzzers
(:issue:`3086`).
```
### 6.46.7
```
-------------------
This patch updates the type annotations for :func:`~hypothesis.strategies.tuples` and
:func:`~hypothesis.strategies.one_of` so that type-checkers require its arguments to be
positional-only, and so that it no longer fails under pyright-strict mode (see
:issue:`3348`). Additional changes are made to Hypothesis' internals improve pyright
scans.
```
### 6.46.6
```
-------------------
This patch by Cheuk Ting Ho adds support for :pep:`655` ``Required`` and ``NotRequired`` as attributes of
:class:`~python:typing.TypedDict` in :func:`~hypothesis.strategies.from_type` (:issue:`3339`).
```
### 6.46.5
```
-------------------
This patch fixes :func:`~hypothesis.extra.numpy.from_dtype` with long-precision
floating-point datatypes (typecode ``g``; see :func:`numpy:numpy.typename`).
```
### 6.46.4
```
-------------------
This patch improves some error messages for custom signatures
containing invalid parameter names (:issue:`3317`).
```
### 6.46.3
```
-------------------
This patch by Cheuk Ting Ho makes it an explicit error to call :func:`~hypothesis.strategies.from_type`
or :func:`~hypothesis.strategies.register_type_strategy` with types that have no runtime instances (:issue:`3280`).
```
### 6.46.2
```
-------------------
This patch fixes silently dropping examples when the :obj:`example <hypothesis.example>`
decorator is applied to itself (:issue:`3319`). This was always a weird pattern, but now it
works. Thanks to Ray Sogata, Keeri Tramm, and Kevin Khuong for working on this patch!
```
### 6.46.1
```
-------------------
This patch fixes a rare bug where we could incorrectly treat
:obj:`~python:inspect.Parameter.empty` as a type annotation,
if the callable had an explicitly assigned ``__signature__``.
```
### 6.46.0
```
-------------------
This release adds an ``allow_nil`` argument to :func:`~hypothesis.strategies.uuids`,
which you can use to... generate the nil UUID. Thanks to Shlok Gandhi for the patch!
```
### 6.45.4
```
-------------------
This patch fixes some missing imports for certain :doc:`Ghostwritten <ghostwriter>`
tests. Thanks to Mel Seto for fixing :issue:`3316`.
```
### 6.45.3
```
-------------------
This patch teaches :doc:`the Ghostwriter <ghostwriter>` to recognize
many more common argument names (:issue:`3311`).
```
### 6.45.2
```
-------------------
This patch fixes :issue:`3314`, where Hypothesis would raise an internal
error from :func:`~hypothesis.provisional.domains` or (only on Windows)
from :func:`~hypothesis.strategies.timezones` in some rare circumstances
where the installation was subtly broken.
Thanks to Munir Abdinur for this contribution.
```
### 6.45.1
```
-------------------
This release fixes deprecation warnings about ``sre_compile`` and ``sre_parse``
imports and ``importlib.resources`` usage when running Hypothesis on Python 3.11.
Thanks to Florian Bruhin for this contribution.
```
### 6.45.0
```
-------------------
This release updates :func:`xps.indices` by introducing an ``allow_newaxis``
argument, defaulting to ``False``. If ``allow_newaxis=True``, indices can be
generated that add dimensions to arrays, which is achieved by the indexer
containing ``None``. This change is to support a specification change that
expand dimensions via indexing (`data-apis/array-api408
<https://github.com/data-apis/array-api/pull/408>`_).
```
### 6.44.0
```
-------------------
This release adds a ``names`` argument to :func:`~hypothesis.extra.pandas.indexes`
and :func:`~hypothesis.extra.pandas.series`, so that you can create Pandas
objects with specific or varied names.
Contributed by Sam Watts.
```
### 6.43.3
```
-------------------
This patch updates the type annotations for :func:`given <hypothesis.given>`
so that type-checkers will warn on mixed positional and keyword arguments,
as well as fixing :issue:`3296`.
```
### 6.43.2
```
-------------------
Fixed a type annotation for ``pyright --strict`` (:issue:`3287`).
```
### 6.43.1
```
-------------------
This patch makes it an explicit error to call
:func:`~hypothesis.strategies.registe
This PR updates hypothesis from 5.6.0 to 6.99.6.
Changelog
### 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 patch improves the error message when Hypothesis detects "flush to zero" mode for floating-point: we now report which package(s) enabled this, which can make debugging much easier. See :issue:`3458` for details. ``` ### 6.56.0 ``` ------------------- This release defines ``__bool__()`` on :class:`~hypothesis.strategies.SearchStrategy`. It always returns ``True``, like before, but also emits a warning to help with cases where you intended to draw a value (:issue:`3463`). ``` ### 6.55.0 ``` ------------------- In preparation for `future versions of the Array API standard <https://data-apis.org/array-api/latest/future_API_evolution.html>`__, :func:`~hypothesis.extra.array_api.make_strategies_namespace` now accepts an optional ``api_version`` argument, which determines the version conformed to by the returned strategies namespace. If ``None``, the version of the passed array module ``xp`` is inferred. This release also introduces :func:`xps.real_dtypes`. This is currently equivalent to the existing :func:`xps.numeric_dtypes` strategy, but exists because the latter is expected to include complex numbers in the next version of the standard. ``` ### 6.54.6 ``` ------------------- If multiple explicit examples (from :obj:`example() <hypothesis.example>`) raise a Skip exception, for consistency with generated examples we now re-raise the first instead of collecting them into an ExceptionGroup (:issue:`3453`). ``` ### 6.54.5 ``` ------------------- This patch updates our autoformatting tools, improving our code style without any API changes. ``` ### 6.54.4 ``` ------------------- This patch fixes some type annotations for Python 3.9 and earlier (:issue:`3397`), and teaches :ref:`explain mode <phases>` about certain locations it should not bother reporting (:issue:`3439`). ``` ### 6.54.3 ``` ------------------- This patch teaches the Ghostwriter an additional check for function and class locations that should make it use public APIs more often. ``` ### 6.54.2 ``` ------------------- This patch fixes our workaround for `a pytest bug where the inner exceptions in an ExceptionGroup are not displayed <https://github.com/pytest-dev/pytest/issues/9159>`__ (:issue:`3430`). ``` ### 6.54.1 ``` ------------------- This patch makes ``FailedHealthCheck`` and ``DeadlineExceeded`` exceptions picklable, for compatibility with Django's parallel test runner (:issue:`3426`). ``` ### 6.54.0 ``` ------------------- Reporting of :obj:`multiple failing examples <hypothesis.settings.report_multiple_bugs>` now uses the :pep:`654` `ExceptionGroup <https://docs.python.org/3.11/library/exceptions.html#ExceptionGroup>`__ type, which is provided by the :pypi:`exceptiongroup` backport on Python 3.10 and earlier (:issue:`3175`). ``hypothesis.errors.MultipleFailures`` is therefore deprecated. Failing examples and other reports are now stored as :pep:`678` exception notes, which ensures that they will always appear together with the traceback and other information about their respective error. ``` ### 6.53.0 ``` ------------------- :func:`~hypothesis.extra.django.from_field` now supports ``UsernameField`` from :mod:`django.contrib.auth.forms`. Thanks to Afonso Silva for reporting and working on :issue:`3417`. ``` ### 6.52.4 ``` ------------------- This patch improves the error message when you pass filenames to the :command:`hypothesis write` CLI, which takes the name of a module or function (e.g. :command:`hypothesis write gzip` or :command:`hypothesis write package.some_function` rather than :command:`hypothesis write script.py`). Thanks to Ed Rogers for implementing this as part of the SciPy 2022 sprints! ``` ### 6.52.3 ``` ------------------- This patch ensures that the warning for non-interactive ``.example()`` points to your code instead of Hypothesis internals (:issue:`3403`). Thanks to jameslamb for this fix. ``` ### 6.52.2 ``` ------------------- This patch makes :func:`~hypothesis.strategies.integers` more likely to generate boundary values for large two-sided intervals (:issue:`2942`). ``` ### 6.52.1 ``` ------------------- This patch adds filter rewriting for :func:`math.isfinite`, :func:`math.isinf`, and :func:`math.isnan` on :func:`~hypothesis.strategies.integers` or :func:`~hypothesis.strategies.floats` (:issue:`2701`). Thanks to Sam Clamons at the SciPy Sprints! ``` ### 6.52.0 ``` ------------------- This release adds the ``allow_subnormal`` argument to :func:`~hypothesis.strategies.complex_numbers` by applying it to each of the real and imaginary parts separately. Closes :issue:`3390`. Thanks to Evan Tey for this fix. ``` ### 6.51.0 ``` ------------------- Issue a deprecation warning if a function decorated with :func:`composite <hypothesis.strategies.composite>` does not draw any values (:issue:`3384`). Thanks to Grzegorz Zieba, Rodrigo Girão, and Thomas Ball for working on this at the EuroPython sprints! ``` ### 6.50.1 ``` ------------------- This patch improves the error messages in :obj:`example() <hypothesis.example>` argument validation following the recent release of :ref:`6.49.1 <v6.49.1>`. ``` ### 6.50.0 ``` ------------------- This release allows :func:`~hypothesis.extra.numpy.from_dtype` to generate Unicode strings which cannot be encoded in UTF-8, but are valid in Numpy arrays (which use UTF-32). This logic will only be used with :pypi:`Numpy` >= 1.19, because earlier versions have `an issue <https://github.com/numpy/numpy/issues/15363>`__ which led us to revert :ref:`Hypothesis 5.2 <v5.2.0>` last time! ``` ### 6.49.1 ``` ------------------- This patch fixes some inconsistency between argument handling for :obj:`example <hypothesis.example>` and :func:`given <hypothesis.given>` (:issue:`2706 <2706issuecomment-1168363177>`). ``` ### 6.49.0 ``` ------------------- This release uses :pep:`612` :obj:`python:typing.ParamSpec` (or the :pypi:`typing_extensions` backport) to express the first-argument-removing behaviour of :func:`st.composite <hypothesis.strategies.composite>` and signature-preservation of :func:`~hypothesis.strategies.functions` to IDEs, editor plugins, and static type checkers such as :pypi:`mypy`. ``` ### 6.48.3 ``` ------------------- :func:`hypothesis.event` now works for hashable objects which do not support weakrefs, such as integers and tuples. ``` ### 6.48.2 ``` ------------------- This patch tidies up some internal introspection logic, which will improve support for positional-only arguments in a future release (:issue:`2706`). ``` ### 6.48.1 ``` ------------------- This release automatically rewrites some simple filters, such as ``floats().filter(lambda x: x >= 10)`` to the more efficient ``floats(min_value=10)``, based on the AST of the predicate. We continue to recommend using the efficient form directly wherever possible, but this should be useful for e.g. :pypi:`pandera` "``Checks``" where you already have a simple predicate and translating manually is really annoying. See :issue:`2701` for details. ``` ### 6.48.0 ``` ------------------- This release raises :class:`~unittest.SkipTest` for tests which never executed any examples, for example because the :obj:`~hypothesis.settings.phases` setting excluded the :obj:`~hypothesis.Phase.explicit`, :obj:`~hypothesis.Phase.reuse`, and :obj:`~hypothesis.Phase.generate` phases. This helps to avoid cases where broken tests appear to pass, because they didn't actually execute (:issue:`3328`). ``` ### 6.47.5 ``` ------------------- This patch fixes type annotations that had caused the signature of :func:`given <hypothesis.given>` to be partially-unknown to type-checkers for Python versions before 3.10. ``` ### 6.47.4 ``` ------------------- This patch fixes :func:`~hypothesis.strategies.from_type` on Python 3.11, following `python/cpython93754 <https://github.com/python/cpython/pull/93754/>`__. ``` ### 6.47.3 ``` ------------------- This patch makes the :obj:`~hypothesis.HealthCheck.too_slow` health check more consistent with long :obj:`~hypothesis.settings.deadline` tests (:issue:`3367`) and fixes an install issue under :pypi:`pipenv` which was introduced in :ref:`Hypothesis 6.47.2 <v6.47.2>` (:issue:`3374`). ``` ### 6.47.2 ``` ------------------- We now use the :pep:`654` `ExceptionGroup <https://docs.python.org/3.11/library/exceptions.html#ExceptionGroup>`__ type - provided by the :pypi:`exceptiongroup` backport on older Pythons - to ensure that if multiple errors are raised in teardown, they will all propagate. ``` ### 6.47.1 ``` ------------------- Our pretty-printer no longer sorts dictionary keys, since iteration order is stable in Python 3.7+ and this can affect reproducing examples (:issue:`3370`). This PR was kindly supported by `Ordina Pythoneers <https://www.ordina.nl/vakgebieden/python/>`__. ``` ### 6.47.0 ``` ------------------- The :doc:`Ghostwritter <ghostwriter>` can now write tests for :obj:`classmethod <classmethod>` or :obj:`staticmethod <staticmethod>` methods, in addition to the existing support for functions and other callables (:issue:`3318`). Thanks to Cheuk Ting Ho for the patch. ``` ### 6.46.11 ``` -------------------- Mention :func:`hypothesis.strategies.timezones` in the documentation of :func:`hypothesis.strategies.datetimes` for completeness. Thanks to George Macon for this addition. ``` ### 6.46.10 ``` -------------------- This release contains some small improvements to our documentation. Thanks to Felix Divo for his contribution! ``` ### 6.46.9 ``` ------------------- This patch by Adrian Garcia Badaracco adds type annotations to some private internals (:issue:`3074`). ``` ### 6.46.8 ``` ------------------- This patch by Phillip Schanely makes changes to the :func:`~hypothesis.strategies.floats` strategy when ``min_value`` or ``max_value`` is present. Hypothesis will now be capable of generating every representable value in the bounds. You may notice that hypothesis is more likely to test values near boundaries, and values that are very close to zero. These changes also support future integrations with symbolic execution tools and fuzzers (:issue:`3086`). ``` ### 6.46.7 ``` ------------------- This patch updates the type annotations for :func:`~hypothesis.strategies.tuples` and :func:`~hypothesis.strategies.one_of` so that type-checkers require its arguments to be positional-only, and so that it no longer fails under pyright-strict mode (see :issue:`3348`). Additional changes are made to Hypothesis' internals improve pyright scans. ``` ### 6.46.6 ``` ------------------- This patch by Cheuk Ting Ho adds support for :pep:`655` ``Required`` and ``NotRequired`` as attributes of :class:`~python:typing.TypedDict` in :func:`~hypothesis.strategies.from_type` (:issue:`3339`). ``` ### 6.46.5 ``` ------------------- This patch fixes :func:`~hypothesis.extra.numpy.from_dtype` with long-precision floating-point datatypes (typecode ``g``; see :func:`numpy:numpy.typename`). ``` ### 6.46.4 ``` ------------------- This patch improves some error messages for custom signatures containing invalid parameter names (:issue:`3317`). ``` ### 6.46.3 ``` ------------------- This patch by Cheuk Ting Ho makes it an explicit error to call :func:`~hypothesis.strategies.from_type` or :func:`~hypothesis.strategies.register_type_strategy` with types that have no runtime instances (:issue:`3280`). ``` ### 6.46.2 ``` ------------------- This patch fixes silently dropping examples when the :obj:`example <hypothesis.example>` decorator is applied to itself (:issue:`3319`). This was always a weird pattern, but now it works. Thanks to Ray Sogata, Keeri Tramm, and Kevin Khuong for working on this patch! ``` ### 6.46.1 ``` ------------------- This patch fixes a rare bug where we could incorrectly treat :obj:`~python:inspect.Parameter.empty` as a type annotation, if the callable had an explicitly assigned ``__signature__``. ``` ### 6.46.0 ``` ------------------- This release adds an ``allow_nil`` argument to :func:`~hypothesis.strategies.uuids`, which you can use to... generate the nil UUID. Thanks to Shlok Gandhi for the patch! ``` ### 6.45.4 ``` ------------------- This patch fixes some missing imports for certain :doc:`Ghostwritten <ghostwriter>` tests. Thanks to Mel Seto for fixing :issue:`3316`. ``` ### 6.45.3 ``` ------------------- This patch teaches :doc:`the Ghostwriter <ghostwriter>` to recognize many more common argument names (:issue:`3311`). ``` ### 6.45.2 ``` ------------------- This patch fixes :issue:`3314`, where Hypothesis would raise an internal error from :func:`~hypothesis.provisional.domains` or (only on Windows) from :func:`~hypothesis.strategies.timezones` in some rare circumstances where the installation was subtly broken. Thanks to Munir Abdinur for this contribution. ``` ### 6.45.1 ``` ------------------- This release fixes deprecation warnings about ``sre_compile`` and ``sre_parse`` imports and ``importlib.resources`` usage when running Hypothesis on Python 3.11. Thanks to Florian Bruhin for this contribution. ``` ### 6.45.0 ``` ------------------- This release updates :func:`xps.indices` by introducing an ``allow_newaxis`` argument, defaulting to ``False``. If ``allow_newaxis=True``, indices can be generated that add dimensions to arrays, which is achieved by the indexer containing ``None``. This change is to support a specification change that expand dimensions via indexing (`data-apis/array-api408 <https://github.com/data-apis/array-api/pull/408>`_). ``` ### 6.44.0 ``` ------------------- This release adds a ``names`` argument to :func:`~hypothesis.extra.pandas.indexes` and :func:`~hypothesis.extra.pandas.series`, so that you can create Pandas objects with specific or varied names. Contributed by Sam Watts. ``` ### 6.43.3 ``` ------------------- This patch updates the type annotations for :func:`given <hypothesis.given>` so that type-checkers will warn on mixed positional and keyword arguments, as well as fixing :issue:`3296`. ``` ### 6.43.2 ``` ------------------- Fixed a type annotation for ``pyright --strict`` (:issue:`3287`). ``` ### 6.43.1 ``` ------------------- This patch makes it an explicit error to call :func:`~hypothesis.strategies.registe