Skip to content

Update hypothesis to 6.130.4#104

Closed
pyup-bot wants to merge 1 commit intomasterfrom
pyup-update-hypothesis-6.125.2-to-6.130.4
Closed

Update hypothesis to 6.130.4#104
pyup-bot wants to merge 1 commit intomasterfrom
pyup-update-hypothesis-6.125.2-to-6.130.4

Conversation

@pyup-bot
Copy link
Collaborator

This PR updates hypothesis from 6.125.2 to 6.130.4.

Changelog

6.130.4

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

Improve an additional interaction between the :pypi:`hypothesis-crosshair`
:ref:`backend <alternative-backends>` and :ref:`our observability tools <observability>`.

6.130.3

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

This patch improves the interaction between the :pypi:`hypothesis-crosshair`
:ref:`backend <alternative-backends>` and :ref:`our observability tools <observability>`.

6.130.2

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

Fix an issue with realizing symbolic values provided by :ref:`alternative backends <alternative-backends>` when Hypothesis encounters an internal error in its engine.

6.130.1

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

Improve the documentation for some strategies, including |st.composite| and |st.data|.

6.130.0

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

Nesting :func:`given <hypothesis.given>` inside of :func:`given <hypothesis.given>` is now a :ref:`health check <healthchecks>` failure. Nesting :func:`given <hypothesis.given>` results in quadratic generation and shrinking behavior, and can usually be more cleanly expressed by replacing the inner function with a :func:`~hypothesis.strategies.data` parameter on the outer given. For more details, see :obj:`~hypothesis.HealthCheck.nested_given`. (:issue:`4167`)

6.129.5

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

Fixes an internal error when certain :ref:`alternative backends <alternative-backends>` find a failure on their very first generated example.

6.129.4

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

:func:`~hypothesis.strategies.nothing` is now typed as ``SearchStrategy[Never]``, because no value can ever be drawn from it. This may help type checkers statically determine that some code is not reachable.

6.129.3

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

This patch improves the string representation of :func:`~hypothesis.strategies.fixed_dictionaries`.

6.129.2

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

Improve how the shrinker checks for unnecessary work, leading to 10% less time spent shrinking on average, with no reduction in quality.

6.129.1

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

:func:`~hypothesis.strategies.randoms` no longer produces ``1.0``, matching
the exclusive upper bound of :obj:`random.Random.random` (:issue:`4297`).

6.129.0

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

This release adds a ``"hypothesis-urandom"`` :ref:`backend <alternative-backends>`, which draws randomness from ``/dev/urandom`` instead of Python's PRNG. This is useful for users of `Antithesis <https://antithesis.com/>`_ who also have Hypothesis tests, allowing Antithesis mutation of ``/dev/urandom`` to drive Hypothesis generation. We expect it to be strictly slower than the default backend for everyone else.

It can be enabled with ``settings(backend="hypothesis-urandom")``.

6.128.3

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

For strategies which draw make recursive draws, including :func:`~hypothesis.strategies.recursive` and :func:`~hypothesis.strategies.deferred`, we now generate examples with duplicated subtrees more often. This tends to uncover interesting behavior in tests.

For instance, we might now generate a tree like this more often (though the details depend on the strategy):

.. code-block:: none

              ┌─────┐
       ┌──────┤  a  ├──────┐
       │      └─────┘      │
    ┌──┴──┐             ┌──┴──┐
    │  b  │             │  a  │
    └──┬──┘             └──┬──┘
  ┌────┴────┐         ┌────┴────┐
┌──┴──┐   ┌──┴──┐   ┌──┴──┐   ┌──┴──┐
│  c  │   │  d  │   │  b  │   │ ... │
└─────┘   └─────┘   └──┬──┘   └─────┘
                 ┌────┴────┐
              ┌──┴──┐   ┌──┴──┐
              │  c  │   │  d  │
              └─────┘   └─────┘

6.128.2

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

Improves input validation for several strategies in our :ref:`pandas extra
<hypothesis-pandas>`, so that they raise a helpful ``InvalidArgument`` rather
than ``OverflowError``.

Discovered by our recent :ref:`string generation upgrade <v6.128.0>`.

6.128.1

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

Rename a few internal classes for clarity.

6.128.0

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

:func:`~hypothesis.strategies.text` now occasionally generates from a preselected list of strings which are likely to find bugs. These include ligatures, right-to-left and top-to-bottom text, emojis, emoji modifiers, strings like ``"Infinity"``, ``"None"``, and ``"FALSE"``, and other interesting things. This is especially useful when testing the full unicode range, where the search space is too large for uniform sampling to be very effective.

Of course, examples generated this way shrink just like they normally would. It was always possible for Hypothesis to generate these strings; it is just more likely after this change. From the outside, it is as if Hypothesis generated the example completely randomly.

Many thanks to the `Big List of Naughty Strings <https://github.com/minimaxir/big-list-of-naughty-strings>`_, `Text Rendering Hates You <https://faultlore.com/blah/text-hates-you/>`_, and `Text Editing Hates You Too <https://lord.io/text-editing-hates-you-too/>`_ for forming the basis of this list.

6.127.9

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

We now provide a better string representation for :func:`~hypothesis.strategies.one_of` strategies, by flattening consecutive ``|`` combinations. For instance:

.. code-block:: pycon

 >>> st.integers() | st.text() | st.booleans()
  previously: one_of(one_of(integers(), text()), booleans())
 one_of(integers(), text(), booleans())

Explicit calls to :func:`~hypothesis.strategies.one_of` remain unflattened, in order to make tracking down complicated :func:`~hypothesis.strategies.one_of` constructions easier:

.. code-block:: pycon

 >>> st.one_of(st.integers(), st.one_of(st.text(), st.booleans()))
 one_of(integers(), one_of(text(), booleans()))

We print ``one_of`` in reprs (rather than ``integers() | text() | ...``) for consistency with reprs containing ``.filter`` or ``.map`` calls, which uses the full ``one_of`` to avoid ambiguity.

6.127.8

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

This patch improves shrinking behavior for values from :func:`~hypothesis.strategies.text` and :func:`~hypothesis.strategies.binary` which contain duplicate elements, like ``"zzzabc"``. It also improves shrinking for  bugs which require the same character to be drawn from two different :func:`~hypothesis.strategies.text` strategies to trigger.

6.127.7

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

Fix a type-hinting regression from :ref:`version 6.125.1 <v6.125.1>`, where we would no longer guarantee the type of the argument to ``.filter`` predicates (:issue:`4269`).

.. code-block:: python

x was previously Unknown, but is now correctly guaranteed to be int
st.integers().filter(lambda x: x > 0)

6.127.6

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

This patch tweaks the performance of the :ref:`target phase <phases>`, avoiding aborting some test cases when it would be better to finish generating them.

6.127.5

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

This patch fixes a bug where :func:`~hypothesis.strategies.from_type` would error on certain types involving :class:`~python:typing.Protocol` (:issue:`4194`).

6.127.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.127.3

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

Improve shrinking of non-standard NaN float values (:issue:`4277`).

6.127.2

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

Adjust type hints for the pub-sub database implementation in :ref:`version 6.126.0 <v6.126.0>`, and remove a remnant debug print in its implementation.

6.127.1

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

Improve the clarity of printing counterexamples in :ref:`stateful testing <stateful>`, by avoiding confusing :class:`~hypothesis.stateful.Bundle` references with equivalent values drawn from a regular strategy.

For example, we now print:

.. code-block:: python

a_0 = state.add_to_bundle(a=0)
state.unrelated(value=0)

instead of

.. code-block:: python

a_0 = state.add_to_bundle(a=0)
state.unrelated(value=a_0)

if the ``unrelated`` rule draws from a regular strategy such as :func:`~hypothesis.strategies.integers` instead of the ``a`` bundle.

6.127.0

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

This releases adds support for type aliases created with the :py:keyword:`type` statement (new in python 3.12) to :func:`~hypothesis.strategies.from_type` and :func:`~hypothesis.strategies.register_type_strategy`.

6.126.0

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

The :ref:`Hypothesis database <database>` now supports a pub-sub interface to efficiently listen for changes in the database, via ``.add_listener`` and ``.remove_listener``. While all databases that ship with Hypothesis support this interface, implementing it is not required for custom database subclasses. Hypothesis will warn when trying to listen on a database without support.

This feature is currently only used downstream in `hypofuzz <https://github.com/zac-hd/hypofuzz>`_.

6.125.3

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

Improves sharing of some internal cache behavior.
Links

@pyup-bot
Copy link
Collaborator Author

Closing this in favor of #108

@pyup-bot pyup-bot closed this Mar 28, 2025
@asmfreak asmfreak deleted the pyup-update-hypothesis-6.125.2-to-6.130.4 branch March 28, 2025 17:46
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.

1 participant