Hypothesis

Latest version: v6.100.1

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

Scan your dependencies

Page 155 of 195

3.50.0

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

This release improves validation of numeric bounds for some strategies.

- :func:`~hypothesis.strategies.integers` and :func:`~hypothesis.strategies.floats`
now raise ``InvalidArgument`` if passed a ``min_value`` or ``max_value``
which is not an instance of :class:`~python:numbers.Real`, instead of
various internal errors.
- :func:`~hypothesis.strategies.floats` now converts its bounding values to
the nearest float above or below the min or max bound respectively, instead
of just casting to float. The old behaviour was incorrect in that you could
generate ``float(min_value)``, even when this was less than ``min_value``
itself (possible with eg. fractions).
- When both bounds are provided to :func:`~hypothesis.strategies.floats` but
there are no floats in the interval, such as ``[(2**54)+1 .. (2**55)-1]``,
InvalidArgument is raised.
- :func:`~hypothesis.strategies.decimals` gives a more useful error message
if passed a string that cannot be converted to :class:`~python:decimal.Decimal`
in a context where this error is not trapped.

Code that previously **seemed** to work may be explicitly broken if there
were no floats between ``min_value`` and ``max_value`` (only possible with
non-float bounds), or if a bound was not a :class:`~python:numbers.Real`
number but still allowed in :obj:`python:math.isnan` (some custom classes
with a ``__float__`` method).

3.49.1

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

This patch fixes our tests for Numpy dtype strategies on big-endian platforms,
where the strategy behaved correctly but the test assumed that the native byte
order was little-endian.

There is no user impact unless you are running our test suite on big-endian
platforms. Thanks to Graham Inggs for reporting :issue:`1164`.

3.49.0

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

This release deprecates passing ``elements=None`` to collection strategies,
such as :func:`~hypothesis.strategies.lists`.

Requiring ``lists(nothing())`` or ``builds(list)`` instead of ``lists()``
means slightly more typing, but also improves the consistency and
discoverability of our API - as well as showing how to compose or
construct strategies in ways that still work in more complex situations.

Passing a nonzero max_size to a collection strategy where the elements
strategy contains no values is now deprecated, and will be an error in a
future version. The equivalent with ``elements=None`` is already an error.

3.48.1

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

This patch will minimize examples that would come out non-minimal in previous versions. Thanks to Kyle Reeve for this patch.

3.48.0

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

This release improves some "unhappy paths" when using Hypothesis
with the standard library :mod:`python:unittest` module:

- Applying :func:`given <hypothesis.given>` to a non-test method which is
overridden from :class:`python:unittest.TestCase`, such as ``setUp``,
raises :attr:`a new health check <hypothesis.HealthCheck.not_a_test_method>`.
(:issue:`991`)
- Using :meth:`~python:unittest.TestCase.subTest` within a test decorated
with :func:`given <hypothesis.given>` would leak intermediate results
when tests were run under the :mod:`python:unittest` test runner.
Individual reporting of failing subtests is now disabled during a test
using :func:`given <hypothesis.given>`. (:issue:`1071`)
- :func:`given <hypothesis.given>` is still not a class decorator, but the
error message if you try using it on a class has been improved.

As a related improvement, using :class:`django:django.test.TestCase` with
:func:`given <hypothesis.given>` instead of
:class:`hypothesis.extra.django.TestCase` raises an explicit error instead
of running all examples in a single database transaction.

3.47.0

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

:obj:`~hypothesis.settings.register_profile` now accepts keyword arguments
for specific settings, and the parent settings object is now optional.
Using a ``name`` for a registered profile which is not a string was never
suggested, but it is now also deprecated and will eventually be an error.

Page 155 of 195

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.