Hypothesis

Latest version: v6.122.3

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

Scan your dependencies

Page 195 of 210

3.7.1

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

This is a bug fix and internal improvements release.

* In particular Hypothesis now tracks a tree of where it has already explored.
This allows it to avoid some classes of duplicate examples, and significantly
improves the performance of shrinking failing examples by allowing it to
skip some shrinks that it can determine can't possibly work.
* Hypothesis will no longer seed the global random arbitrarily unless you have
asked it to using :py:meth:`~hypothesis.strategies.random_module`
* Shrinking would previously have not worked correctly in some special cases
on Python 2, and would have resulted in suboptimal examples.

3.7.0

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

This is a feature release.

New features:

* Rule based stateful testing now has an :func:`invariant <hypothesis.stateful.invariant>` decorator that specifies
methods that are run after init and after every step, allowing you to
encode properties that should be true at all times. Thanks to Tom Prince for
this feature.
* The :func:`~hypothesis.strategies.decimals` strategy now supports ``allow_nan`` and ``allow_infinity`` flags.
* There are :ref:`significantly more strategies available for numpy <hypothesis-numpy>`, including for
generating arbitrary data types. Thanks to Zac Hatfield Dodds for this
feature.
* When using the :func:`~hypothesis.strategies.data` strategy you can now add a label as an argument to
``draw()``, which will be printed along with the value when an example fails.
Thanks to Peter Inglesby for this feature.

Bug fixes:

* Bug fix: :func:`~hypothesis.strategies.composite` now preserves functions' docstrings.
* The build is now reproducible and doesn't depend on the path you build it
from. Thanks to Chris Lamb for this feature.
* numpy strategies for the void data type did not work correctly. Thanks to
Zac Hatfield Dodds for this fix.

There have also been a number of performance optimizations:

* The :func:`~hypothesis.strategies.permutations` strategy is now significantly faster to use for large
lists (the underlying algorithm has gone from O(n^2) to O(n)).
* Shrinking of failing test cases should have got significantly faster in
some circumstances where it was previously struggling for a long time.
* Example generation now involves less indirection, which results in a small
speedup in some cases (small enough that you won't really notice it except in
pathological cases).

3.6.1

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

This release fixes a dependency problem and makes some small behind the scenes
improvements.

* The fake-factory dependency was renamed to faker. If you were depending on
it through hypothesis[django] or hypothesis[fake-factory] without pinning it
yourself then it would have failed to install properly. This release changes
it so that hypothesis[fakefactory] (which can now also be installed as
hypothesis[faker]) will install the renamed faker package instead.
* This release also removed the dependency of hypothesis[django] on
hypothesis[fakefactory] - it was only being used for emails. These now use
a custom strategy that isn't from fakefactory. As a result you should also
see performance improvements of tests which generated User objects or other
things with email fields, as well as better shrinking of email addresses.
* The distribution of code using nested calls to :func:`~hypothesis.strategies.one_of` or the ``|`` operator for
combining strategies has been improved, as branches are now flattened to give
a more uniform distribution.
* Examples using :func:`~hypothesis.strategies.composite` or ``.flatmap`` should now shrink better. In particular
this will affect things which work by first generating a length and then
generating that many items, which have historically not shrunk very well.

3.6.0

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

This release reverts Hypothesis to its old pretty printing of lambda functions
based on attempting to extract the source code rather than decompile the bytecode.
This is unfortunately slightly inferior in some cases and may result in you
occasionally seeing things like ``lambda x: <unknown>`` in statistics reports and
strategy reprs.

This removes the dependencies on uncompyle6, xdis and spark-parser.

The reason for this is that the new functionality was based on uncompyle6, which
turns out to introduce a hidden GPLed dependency - it in turn depended on xdis,
and although the library was licensed under the MIT license, it contained some
GPL licensed source code and thus should have been released under the GPL.

My interpretation is that Hypothesis itself was never in violation of the GPL
(because the license it is under, the Mozilla Public License v2, is fully
compatible with being included in a GPL licensed work), but I have not consulted
a lawyer on the subject. Regardless of the answer to this question, adding a
GPLed dependency will likely cause a lot of users of Hypothesis to inadvertently
be in violation of the GPL.

As a result, if you are running Hypothesis 3.5.x you really should upgrade to
this release immediately.

3.5.3

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

This is a bug fix release.

Bugs fixed:

* If the same test was running concurrently in two processes and there were
examples already in the test database which no longer failed, Hypothesis
would sometimes fail with a FileNotFoundError (IOError on Python 2) because
an example it was trying to read was deleted before it was read. (:issue:`372`).
* Drawing from an :func:`~hypothesis.strategies.integers` strategy with both a min_value and a max_value
would reject too many examples needlessly. Now it repeatedly redraws until
satisfied. (:pull:`366`. Thanks to Calen Pennington for the contribution).

3.5.2

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

This is a bug fix release.

* The Hypothesis pytest plugin broke pytest support for doctests. Now it doesn't.

Page 195 of 210

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.