Hypothesis

Latest version: v6.127.9

Safety actively analyzes 712615 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 218

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.

Page 1 of 218

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.