Hypothesis

Latest version: v6.99.13

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

Scan your dependencies

Page 146 of 194

3.66.4

Not secure
-------------------

This release improves the shrinker's ability to reorder examples.

For example, consider the following test:

.. code-block:: python

import hypothesis.strategies as st
from hypothesis import given


given(st.text(), st.text())
def test_non_equal(x, y):
assert x != y

Previously this could have failed with either of ``x="", y="0"`` or
``x="0", y=""``. Now it should always fail with ``x="", y="0"``.

This will allow the shrinker to produce more consistent results, especially in
cases where test cases contain some ordered collection whose actual order does
not matter.

3.66.3

Not secure
-------------------

This patch fixes inference in the :func:`~hypothesis.strategies.builds`
strategy with subtypes of :class:`python:typing.NamedTuple`, where the
``__init__`` method is not useful for introspection. We now use the
field types instead - thanks to James Uther for identifying this bug.

3.66.2

Not secure
-------------------

This release improves the shrinker's ability to handle situations where there
is an additive constraint between two values.

For example, consider the following test:


.. code-block:: python

import hypothesis.strategies as st
from hypothesis import given


given(st.integers(), st.integers())
def test_does_not_exceed_100(m, n):
assert m + n < 100

Previously this could have failed with almost any pair ``(m, n)`` with
``0 <= m <= n`` and ``m + n == 100``. Now it should almost always fail with
``m=0, n=100``.

This is a relatively niche specialisation, but can be useful in situations
where e.g. a bug is triggered by an integer overflow.

3.66.1

Not secure
-------------------

This patch fixes a rare bug where an incorrect percentage drawtime
could be displayed for a test, when the system clock was changed during
a test running under Python 2 (we use :func:`python:time.monotonic`
where it is available to avoid such problems). It also fixes a possible
zero-division error that can occur when the underlying C library
double-rounds an intermediate value in :func:`python:math.fsum` and
gets the least significant bit wrong.

3.66.0

Not secure
-------------------

This release improves validation of the ``alphabet`` argument to the
:func:`~hypothesis.strategies.text` strategy. The following misuses
are now deprecated, and will be an error in a future version:

- passing an unordered collection (such as ``set('abc')``), which
violates invariants about shrinking and reproducibility
- passing an alphabet sequence with elements that are not strings
- passing an alphabet sequence with elements that are not of length one,
which violates any size constraints that may apply

Thanks to Sushobhit for adding these warnings (:issue:`1329`).

3.65.3

Not secure
-------------------

This release fixes a mostly theoretical bug where certain usage of the internal
API could trigger an assertion error inside Hypothesis. It is unlikely that
this problem is even possible to trigger through the public API.

Page 146 of 194

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.