Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pin hypothesis to latest version 6.79.2 #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pyup-bot
Copy link
Collaborator

This PR pins hypothesis to the latest release 6.79.2.

Changelog

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 pyflakes, flake8-comprehensions, and
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 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.register_type_strategy` with a
`Pydantic GenericModel <https://pydantic-docs.helpmanual.io/usage/models/#generic-models>`__
and a callable, because ``GenericModel`` isn't actually a generic type at
runtime and so you have to register each of the "parametrized versions"
(actually subclasses!) manually.  See :issue:`2940` for more details.

6.43.0

-------------------

This release makes it an explicit error to apply
:func:`pytest.fixture <pytest:pytest.fixture>` to a function which has
already been decorated with :func:`given() <hypothesis.given>`.  Previously,
``pytest`` would convert your test to a fixture, and then never run it.

6.42.3

-------------------

This patch fixes :func:`~hypothesis.strategies.from_type` on a :class:`~python:typing.TypedDict`
with complex annotations, defined in a file using ``from __future__ import annotations``.
Thanks to Katelyn Gigante for identifying and fixing this bug!

6.42.2

-------------------

The Hypothesis pytest plugin was not outputting valid xunit2 nodes when
``--junit-xml`` was specified. This has been broken since Pytest 5.4, which
changed the internal API for adding nodes to the junit report.

This also fixes the issue when using hypothesis with ``--junit-xml`` and
``pytest-xdist`` where the junit xml report would not be xunit2 compatible.
Now, when using with ``pytest-xdist``, the junit report will just omit the
``<properties>`` node.

For more details, see `this pytest issue <https://github.com/pytest-dev/pytest/issues/1126#issuecomment-484581283>`__,
`this pytest issue <https://github.com/pytest-dev/pytest/issues/7767#issuecomment-1082436256>`__,
and :issue:`1935`

Thanks to Brandon Chinn for this bug fix!

6.42.1

-------------------

This patch fixes pretty-printing of regular expressions in Python 3.11.0a7, and
updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,.

6.42.0

-------------------

This release makes ``st.functions(pure=True)`` less noisy (:issue:`3253`),
and generally improves pretty-printing of functions.

6.41.0

-------------------

This release changes the implementation of :const:`~hypothesis.infer` to be an alias
for :obj:`python:Ellipsis`. E.g. ``given(a=infer)`` is now equivalent to ``given(a=...)``. Furthermore, ``given(...)`` can now be specified so that
:func:`given <hypothesis.given>` will infer the strategies for *all* arguments of the
decorated function based on its annotations.

6.40.3

-------------------

This patch simplifies the repr of the strategies namespace returned in
:func:`~hypothesis.extra.array_api.make_strategies_namespace`, e.g.

.. code-block:: pycon

 >>> from hypothesis.extra.array_api import make_strategies_namespace
 >>> from numpy import array_api as xp
 >>> xps = make_strategies_namespace(xp)
 >>> xps
 make_strategies_namespace(numpy.array_api)

6.40.2

-------------------

Fixed :func:`~hypothesis.strategies.from_type` support for
:pep:`604` union types, like ``int | None`` (:issue:`3255`).

6.40.1

-------------------

Fixed an internal error when ``given()`` was passed a lambda.

6.40.0

-------------------

:doc:`The Ghostwriter <ghostwriter>` can now write tests which check that
two or more functions are equivalent on valid inputs, *or* raise the same
type of exception for invalid inputs (:issue:`3267`).

6.39.6

-------------------

This patch makes some quality-of-life improvements to the
:doc:`Ghostwriter <ghostwriter>`: we guess the :func:`~hypothesis.strategies.text`
strategy for arguments named ``text`` (...obvious in hindsight, eh?);
and improved the error message if you accidentally left in a
:func:`~hypothesis.strategies.nothing` or broke your :pypi:`rich` install.

6.39.5

-------------------

This patch improves our error detection and message when Hypothesis is run
on a Python implementation without support for ``-0.0``, which is required
for the :func:`~hypothesis.strategies.floats` strategy but can be disabled by
`unsafe compiler options <https://simonbyrne.github.io/notes/fastmath/>`__
(:issue:`3265`).

6.39.4

-------------------

This patch tweaks some internal formatting.  There is no user-visible change.

6.39.3

-------------------

If the :obj:`~hypothesis.Phase.shrink` phase is disabled, we now stop the
:obj:`~hypothesis.Phase.generate` phase as soon as an error is found regardless
of the value of the ``report_multiple_examples`` setting, since that's
probably what you wanted (:issue:`3244`).

6.39.2

-------------------

This patch clarifies rare error messages in
:func:`~hypothesis.strategies.builds` (:issue:`3225`) and
:func:`~hypothesis.strategies.floats` (:issue:`3207`).

6.39.1

-------------------

This patch fixes a regression where the bound inner function
(``your_test.hypothesis.inner_test``) would be invoked with positional
arguments rather than passing them by name, which broke
:pypi:`pytest-asyncio` (:issue:`3245`).

6.39.0

-------------------

This release improves Hypothesis' handling of positional-only arguments,
which are now allowed :func:`st.composite <hypothesis.strategies.composite>`
strategies.

On Python 3.8 and later, the first arguments to :func:`~hypothesis.strategies.builds`
and :func:`~hypothesis.extra.django.from_model` are now natively positional-only.
In cases which were already errors, the ``TypeError`` from incorrect usage will
therefore be raises immediately when the function is called, rather than when
the strategy object is used.

6.38.0

-------------------

This release makes :func:`~hypothesis.strategies.floats` error *consistently* when
your floating-point hardware has been configured to violate IEEE-754 for
:wikipedia:`subnormal numbers <Subnormal_number>`, instead of
only when an internal assertion was tripped (:issue:`3092`).

If this happens to you, passing ``allow_subnormal=False`` will suppress the explicit
error.  However, we strongly recommend fixing the root cause by disabling global-effect
unsafe-math compiler options instead, or at least consulting e.g. Simon Byrne's
`Beware of fast-math <https://simonbyrne.github.io/notes/fastmath/>`__ explainer first.

6.37.2

-------------------

This patch fixes a bug in stateful testing, where returning a single value
wrapped in :func:`~hypothesis.stateful.multiple` would be printed such that
the assigned variable was a tuple rather than the single element
(:issue:`3236`).

6.37.1

-------------------

This patch fixes a warning under :pypi:`pytest` 7 relating to our
rich traceback display logic (:issue:`3223`).

6.37.0

-------------------

When distinguishing multiple errors, Hypothesis now looks at the inner
exceptions of :pep:`654` ``ExceptionGroup``\ s.

6.36.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.36.1

-------------------

This patch fixes some deprecation warnings from :pypi:`pytest` 7.0,
along with some code formatting and docs updates.

6.36.0

-------------------

This release disallows using :obj:`python:typing.Final`
with :func:`~hypothesis.strategies.from_type`
and :func:`~hypothesis.strategies.register_type_strategy`.

Why?
Because ``Final`` can only be used during ``class`` definition.
We don't generate class attributes.

It also does not make sense as a runtime type on its own.

6.35.1

-------------------

This patch fixes ``hypothesis write`` output highlighting with :pypi:`rich`
version 12.0 and later.

6.35.0

-------------------

This release disallows using :obj:`python:typing.ClassVar`
with :func:`~hypothesis.strategies.from_type`
and :func:`~hypothesis.strategies.register_type_strategy`.

Why?
Because ``ClassVar`` can only be used during ``class`` definition.
We don't generate class attributes.

It also does not make sense as a runtime type on its own.

6.34.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.34.1

-------------------

This patch fixes :issue:`3169`, an extremely rare bug which would
trigger if an internal least-recently-reused cache dropped a newly
added entry immediately after it was added.

6.34.0

-------------------

This release fixes :issue:`3133` and :issue:`3144`, where attempting
to generate Pandas series of lists or sets would fail with confusing
errors if you did not specify ``dtype=object``.

6.33.0

-------------------

This release disallows using :obj:`python:typing.TypeAlias`
with :func:`~hypothesis.strategies.from_type`
and :func:`~hypothesis.strategies.register_type_strategy`.

Why? Because ``TypeAlias`` is not really a type,
it is a tag for type checkers that some expression is a type alias,
not something else.

It does not make sense for Hypothesis to resolve it as a strategy.
References :issue:`2978`.

6.32.1

-------------------

This patch updates our autoformatting tools, improving our code style without any API changes.

6.32.0

-------------------

This release drops support for Python 3.6, which `reached end of life upstream
<https://devguide.python.org/#status-of-python-branches>`__ on 2021-12-23.

6.31.6

-------------------

This patch adds a temporary hook for a downstream tool,
which is not part of the public API.

6.31.5

-------------------

This release updates our copyright headers to `use a general authorship statement and omit the year
<https://www.linuxfoundation.org/blog/copyright-notices-in-open-source-software-projects/>`__.

6.31.4

-------------------

This patch makes the ``.example()`` method more representative of
test-time data generation, albeit often at a substantial cost to
readability (:issue:`3182`).

6.31.3

-------------------

This patch improves annotations on some of Hypothesis' internal functions, in order to
deobfuscate the signatures of some strategies. In particular, strategies shared between
:ref:`hypothesis.extra.numpy <hypothesis-numpy>` and
:ref:`the hypothesis.extra.array_api extra <array-api>` will benefit from this patch.

6.31.2

-------------------

This patch fix invariants display in stateful falsifying examples (:issue:`3185`).

6.31.1

-------------------

This patch updates :func:`xps.indices` so no flat indices are generated, i.e.
generated indices will now always explicitly cover each axes of an array if no
ellipsis is present. This is to be consistent with a specification change that
dropped support for flat indexing
(`272 <https://github.com/data-apis/array-api/pull/272>`_).

6.31.0

-------------------

This release makes us compatible with :pypi:`Django` 4.0, in particular by adding
support for use of :mod:`zoneinfo` timezones (though we respect the new
``USE_DEPRECATED_PYTZ`` setting if you need it).

6.30.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.30.0

-------------------

This release adds an ``allow_subnormal`` argument to the
:func:`~hypothesis.strategies.floats` strategy, which can explicitly toggle the
generation of :wikipedia:`subnormal floats <Subnormal_number>` (:issue:`3155`).
Disabling such generation is useful when testing flush-to-zero builds of
libraries.

:func:`nps.from_dtype() <hypothesis.extra.numpy.from_dtype>` and
:func:`xps.from_dtype` can also accept the ``allow_subnormal`` argument, and
:func:`xps.from_dtype` or :func:`xps.arrays` will disable subnormals by default
if the array module ``xp`` is detected to flush-to-zero (like is typical with
CuPy).

6.29.3

-------------------

This patch fixes a bug in :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes`,
which restricted the patterns of singleton dimensions that could be generated for
dimensions that extended beyond ``base_shape`` (:issue:`3170`).

6.29.2

-------------------

This patch clarifies our pretty-printing of DataFrames (:issue:`3114`).

6.29.1

-------------------

This patch documents :func:`~hypothesis.strategies.timezones`
`Windows-only requirement <https://docs.python.org/3/library/zoneinfo.html#data-sources>`__
for the :pypi:`tzdata` package, and ensures that
``pip install hypothesis[zoneinfo]`` will install the latest version.

6.29.0

-------------------

This release teaches :func:`~hypothesis.strategies.builds` to use
:func:`~hypothesis.strategies.deferred` when resolving unrecognised type hints,
so that you can conveniently register strategies for recursive types
with constraints on some arguments (:issue:`3026`):

.. code-block:: python

 class RecursiveClass:
     def __init__(self, value: int, next_node: typing.Optional["SomeClass"]):
         assert value > 0
         self.value = value
         self.next_node = next_node


 st.register_type_strategy(
     RecursiveClass, st.builds(RecursiveClass, value=st.integers(min_value=1))
 )

6.28.1

-------------------

This release fixes some internal calculations related to collection sizes (:issue:`3143`).

6.28.0

-------------------

This release modifies our :pypi:`pytest` plugin, to avoid importing Hypothesis
and therefore triggering :ref:`Hypothesis' entry points <entry-points>` for
test suites where Hypothesis is installed but not actually used (:issue:`3140`).

6.27.3

-------------------

This release fixes :issue:`3080`, where :func:`~hypothesis.strategies.from_type`
failed on unions containing :pep:`585` builtin generic types (like ``list[int]``)
in Python 3.9 and later.

6.27.2

-------------------

This patch makes the :command:`hypothesis codemod`
:ref:`command <hypothesis-cli>` somewhat faster.

6.27.1

-------------------

This patch changes the backing datastructures of :func:`~hypothesis.register_random`
and a few internal caches to use :class:`weakref.WeakValueDictionary`.  This reduces
memory usage and may improve performance when registered :class:`~random.Random`
instances are only used for a subset of your tests (:issue:`3131`).

6.27.0

-------------------

This release teaches Hypothesis' multiple-error reporting to format tracebacks
using :pypi:`pytest` or :pypi:`better-exceptions`, if they are installed and
enabled (:issue:`3116`).

6.26.0

-------------------

Did you know that of the 2\ :superscript:`64` possible floating-point numbers,
2\ :superscript:`53` of them are ``nan`` - and Python prints them all the same way?

While nans *usually* have all zeros in the sign bit and mantissa, this
`isn't always true <https://wingolog.org/archives/2011/05/18/value-representation-in-javascript-implementations>`__,
and :wikipedia:`'signaling' nans might trap or error <https://en.wikipedia.org/wiki/NaN#Signaling_NaN>`.
To help distinguish such errors in e.g. CI logs, Hypothesis now prints ``-nan`` for
negative nans, and adds a comment like `` Saw 3 signaling NaNs`` if applicable.

6.25.0

-------------------

This release adds special filtering logic to make a few special cases
like ``s.map(lambda x: x)`` and ``lists().filter(len)`` more efficient
(:issue:`2701`).

6.24.6

-------------------

This patch makes :func:`~hypothesis.strategies.floats` generate
:wikipedia:`"subnormal" floating point numbers <Subnormal_number>`
more often, as these rare values can have strange interactions with
`unsafe compiler optimisations like -ffast-math
<https://simonbyrne.github.io/notes/fastmath/#flushing_subnormals_to_zero>`__
(:issue:`2976`).

6.24.5

-------------------

This patch fixes a rare internal error in the :func:`~hypothesis.strategies.datetimes`
strategy, where the implementation of ``allow_imaginary=False`` crashed when checking
a time during the skipped hour of a DST transition *if* the DST offset is negative -
only true of ``Europe/Dublin``, who we presume have their reasons - and the ``tzinfo``
object is a :pypi:`pytz` timezone (which predates :pep:`495`).

6.24.4

-------------------

This patch gives Hypothesis it's own internal :class:`~random.Random` instance,
ensuring that test suites which reset the global random state don't induce
weird correlations between property-based tests (:issue:`2135`).

6.24.3

-------------------

This patch updates documentation of :func:`~hypothesis.note`
(:issue:`3147`).

6.24.2

-------------------

This patch updates internal testing for the :ref:`Array API extra <array-api>`
to be consistent with new specification changes: ``sum()`` not accepting
boolean arrays (`234 <https://github.com/data-apis/array-api/pull/234>`_),
``unique()`` split into separate functions
(`275 <https://github.com/data-apis/array-api/pull/275>`_), and treating NaNs
as distinct (`310 <https://github.com/data-apis/array-api/pull/310>`_). It has
no user visible impact.

6.24.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.24.0

-------------------

This patch updates our vendored `list of top-level domains
<https://data.iana.org/TLD/tlds-alpha-by-domain.txt>`__, which is used
by the provisional :func:`~hypothesis.provisional.domains` strategy.

(did you know that gTLDs can be both `added <https://newgtlds.icann.org/en/>`__
and `removed <https://www.icann.org/resources/pages/gtld-registry-agreement-termination-2015-10-09-en>`__?)

6.23.4

-------------------

This patch adds an error for when ``shapes`` in :func:`xps.arrays()` is not
passed as either a valid shape or strategy.

6.23.3

-------------------

This patch updates our formatting with :pypi:`shed`.

6.23.2

-------------------

This patch replaces external links to :doc:`NumPy <numpy:index>` API docs
with :mod:`sphinx.ext.intersphinx` cross-references. It is purely a documentation improvement.

6.23.1

-------------------

This patch cleans up internal logic for :func:`xps.arrays()`. There is no
user-visible change.

6.23.0

-------------------

This release follows :pypi:`pytest` in considering :class:`SystemExit` and
:class:`GeneratorExit` exceptions to be test failures, meaning that we will
shink to minimal examples and check for flakiness even though they subclass
:class:`BaseException` directly (:issue:`2223`).

:class:`KeyboardInterrupt` continues to interrupt everything, and will be
re-raised immediately.

6.22.0

-------------------

This release adds :class:`~hypothesis.extra.django.LiveServerTestCase` and
:class:`~hypothesis.extra.django.StaticLiveServerTestCase` for django test.
Thanks to Ivan Tham for this feature!

6.21.6

-------------------

This patch fixes some new linter warnings such as :pypi:`flake8-bugbear`'s
``B904`` for explicit exception chaining, so tracebacks might be a bit nicer.

6.21.5

-------------------

This release fixes ``None`` being inferred as the float64 dtype in
:func:`~xps.from_dtype()` and :func:`~xps.arrays()` from the
:ref:`Array API extra <array-api>`.

6.21.4

-------------------

This release fixes the type hint for the
:func:`given() <hypothesis.given>` decorator
when decorating an ``async`` function (:issue:`3099`).

6.21.3

-------------------

This release improves Ghostwritten tests for builtins (:issue:`2977`).

6.21.2

-------------------

This release deprecates use of both ``min_dims > len(shape)`` and
``max_dims > len(shape)`` when ``allow_newaxis == False`` in
:func:`~hypothesis.extra.numpy.basic_indices` (:issue:`3091`).

6.21.1

-------------------

This release improves the behaviour of :func:`~hypothesis.strategies.builds`
and :func:`~hypothesis.strategies.from_type` in certain situations involving
decorators (:issue:`2495` and :issue:`3029`).

6.21.0

-------------------

This release introduces strategies for array/tensor libraries adopting the
`Array API standard <https://data-apis.org/>`__ (:issue:`3037`).
They are available in :ref:`the hypothesis.extra.array_api extra <array-api>`,
and work much like the existing :doc:`strategies for NumPy <numpy>`.

6.20.1

-------------------

This patch fixes :issue:`961`, where calling ``given()`` inline on a
bound method would fail to handle the ``self`` argument correctly.

6.20.0

-------------------

This release allows :func:`~hypothesis.strategies.slices` to generate ``step=None``,
and fixes an off-by-one error where the ``start`` index could be equal to ``size``.
This works fine for all Python sequences and Numpy arrays, but is undefined behaviour
in the `Array API standard <https://data-apis.org/>`__ (see :pull:`3065`).

6.19.0

-------------------

This release makes :doc:`stateful testing <stateful>` more likely to tell you
if you do something unexpected and unsupported:

- The :obj:`~hypothesis.HealthCheck.return_value` health check now applies to
:func:`~hypothesis.stateful.rule` and :func:`~hypothesis.stateful.initialize`
rules, if they don't have ``target`` bundles, as well as
:func:`~hypothesis.stateful.invariant`.
- Using a :func:`~hypothesis.stateful.consumes` bundle as a ``target`` is
deprecated, and will be an error in a future version.

If existing code triggers these new checks, check for related bugs and
misunderstandings - these patterns *never* had any effect.

6.18.0

-------------------

This release teaches :func:`~hypothesis.strategies.from_type` a neat trick:
when resolving an :obj:`python:typing.Annotated` type, if one of the annotations
is a strategy object we use that as the inferred strategy.  For example:

.. code-block:: python

 PositiveInt = Annotated[int, st.integers(min_value=1)]

If there are multiple strategies, we use the last outer-most annotation.
See :issue:`2978` and :pull:`3082` for discussion.

*Requires Python 3.9 or later for*
:func:`get_type_hints(..., include_extras=False) <typing.get_type_hints>`.

6.17.4

-------------------

This patch makes unique :func:`~hypothesis.extra.numpy.arrays` much more
efficient, especially when there are only a few valid elements - such as
for eight-bit integers (:issue:`3066`).

6.17.3

-------------------

This patch fixes the repr of :func:`~hypothesis.extra.numpy.array_shapes`.

6.17.2

-------------------

This patch wraps some internal helper code in our proxies decorator to prevent
mutations of method docstrings carrying over to other instances of the respective
methods.

6.17.1

-------------------

This patch moves some internal helper code in preparation for :issue:`3065`.
There is no user-visible change, unless you depended on undocumented internals.

6.17.0

-------------------

This release adds type annotations to the :doc:`stateful testing <stateful>` API.

Thanks to Ruben Opdebeeck for this contribution!

6.16.0

-------------------

This release adds the :class:`~hypothesis.strategies.DrawFn` type as a reusable
type hint for the ``draw`` argument of
:func:`composite <hypothesis.strategies.composite>` functions.

Thanks to Ruben Opdebeeck for this contribution!

6.15.0

-------------------

This release emits a more useful error message when :func:`given() <hypothesis.given>`
is applied to a coroutine function, i.e. one defined using ``async def`` (:issue:`3054`).

This was previously only handled by the generic :obj:`~hypothesis.HealthCheck.return_value`
health check, which doesn't direct you to use either :ref:`a custom executor <custom-function-execution>`
or a library such as :pypi:`pytest-trio` or :pypi:`pytest-asyncio` to handle it for you.

6.14.9

-------------------

This patch fixes a regression in Hypothesis 6.14.8, where :func:`~hypothesis.strategies.from_type`
failed to resolve types which inherit from multiple parametrised generic types,
affecting the :pypi:`returns` package (:issue:`3060`).

6.14.8

-------------------

This patch ensures that registering a strategy for a subclass of a a parametrised
generic type such as ``class Lines(Sequence[str]):`` will not "leak" into unrelated
strategies such as ``st.from_type(Sequence[int])`` (:issue:`2951`).
Unfortunately this fix requires :pep:`560`, meaning Python 3.7 or later.

6.14.7

-------------------

This patch fixes :issue:`3050`, where :pypi:`attrs` classes could
cause an internal error in the :doc:`ghostwriter <ghostwriter>`.

6.14.6

-------------------

This patch improves the error message for :issue:`3016`, where :pep:`585`
builtin generics with self-referential forward-reference strings cannot be
resolved to a strategy by :func:`~hypothesis.strategies.from_type`.

6.14.5

-------------------

This patch fixes ``hypothesis.strategies._internal.types.is_a_new_type``.
It was failing on Python ``3.10.0b4``, where ``NewType`` is a function.

6.14.4

-------------------

This patch fixes :func:`~hypothesis.strategies.from_type` and
:func:`~hypothesis.strategies.register_type_strategy` for
:obj:`python:typing.NewType` on Python 3.10, which changed the
underlying implementation (see :bpo:`44353` for details).

6.14.3

-------------------

This patch updates our autoformatting tools, improving our code style without any API changes.

6.14.2

-------------------

This patch ensures that we shorten tracebacks for tests which fail due
to inconsistent data generation between runs (i.e. raise ``Flaky``).

6.14.1

-------------------

This patch updates some internal type annotations.
There is no user-visible change.

6.14.0

-------------------

The :ref:`explain phase <phases>` now requires shrinking to be enabled,
and will be automatically skipped for deadline-exceeded errors.

6.13.14

--------------------

This patch improves the :func:`~hypothesis.strategies.tuples` strategy
type annotations, to preserve the element types for up t

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant