Hypothesis

Latest version: v6.122.3

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

Scan your dependencies

Page 182 of 210

3.32.1

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

This patch has two improvements for strategies based on enumerations.

- :func:`~hypothesis.strategies.from_type` now handles enumerations correctly,
delegating to :func:`~hypothesis.strategies.sampled_from`. Previously it
noted that ``Enum.__init__`` has no required arguments and therefore delegated
to :func:`~hypothesis.strategies.builds`, which would subsequently fail.
- When sampling from an :class:`python:enum.Flag`, we also generate combinations
of members. Eg for ``Flag('Permissions', 'READ, WRITE, EXECUTE')`` we can now
generate, ``Permissions.READ``, ``Permissions.READ|WRITE``, and so on.

3.32.0

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

This changes the default value of
the ``use_coverage`` setting to True when
running on pypy (it was already True on CPython).

It was previously set to False because we expected it to be too slow, but
recent benchmarking shows that actually performance of the feature on pypy is
fairly acceptable - sometimes it's slower than on CPython, sometimes it's
faster, but it's generally within a factor of two either way.

3.31.6

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

This patch improves the quality of strategies inferred from Numpy dtypes:

* Integer dtypes generated examples with the upper half of their (non-sign) bits
set to zero. The inferred strategies can now produce any representable integer.
* Fixed-width unicode- and byte-string dtypes now cap the internal example
length, which should improve example and shrink quality.
* Numpy arrays can only store fixed-size strings internally, and allow shorter
strings by right-padding them with null bytes. Inferred string strategies
no longer generate such values, as they can never be retrieved from an array.
This improves shrinking performance by skipping useless values.

This has already been useful in Hypothesis - we found an overflow bug in our
Pandas support, and as a result :func:`~hypothesis.extra.pandas.indexes` and
:func:`~hypothesis.extra.pandas.range_indexes` now check that ``min_size``
and ``max_size`` are at least zero.

3.31.5

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

This release fixes a performance problem in tests where
the ``use_coverage`` setting is True.

Tests experience a slow-down proportionate to the amount of code they cover.
This is still the case, but the factor is now low enough that it should be
unnoticeable. Previously it was large and became much larger in :ref:`3.30.4 <v3.30.4>`.

3.31.4

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

:func:`~hypothesis.strategies.from_type` failed with a very confusing error
if passed a :obj:`~typing.NewType` (:issue:`901`). These pseudo-types
are now unwrapped correctly, and strategy inference works as expected.

3.31.3

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

This release makes some small optimisations to our use of coverage that should
reduce constant per-example overhead. This is probably only noticeable on
examples where the test itself is quite fast. On no-op tests that don't test
anything you may see up to a fourfold speed increase (which is still
significantly slower than without coverage). On more realistic tests the speed
up is likely to be less than that.

Page 182 of 210

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.