Hypothesis

Latest version: v6.100.1

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

Scan your dependencies

Page 183 of 195

3.0.2

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

* Under certain circumstances, strategies involving :func:`~hypothesis.strategies.text` buried inside some
other strategy (e.g. ``text().filter(...)`` or ``recursive(text(), ...))`` would cause
a test to fail its health checks the first time it ran. This was caused by having
to compute some related data and cache it to disk. On travis or anywhere else
where the ``.hypothesis`` directory was recreated this would have caused the tests
to fail their health check on every run. This is now fixed for all the known cases,
although there could be others lurking.

3.0.1

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

* Fix a case where it was possible to trigger an "Unreachable" assertion when
running certain flaky stateful tests.
* Improve shrinking of large stateful tests by eliminating a case where it was
hard to delete early steps.
* Improve efficiency of drawing :func:`binary(min_size=n, max_size=n) <hypothesis.strategies.binary>` significantly by
provide a custom implementation for fixed size blocks that can bypass a lot
of machinery.
* Set default home directory based on the current working directory at the
point Hypothesis is imported, not whenever the function first happens to be
called.

3.0.0

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

Codename: This really should have been 2.1.

Externally this looks like a very small release. It has one small breaking change
that probably doesn't affect anyone at all (some behaviour that never really worked
correctly is now outright forbidden) but necessitated a major version bump and one
visible new feature.

Internally this is a complete rewrite. Almost nothing other than the public API is
the same.

New features:

* Addition of :func:`~hypothesis.strategies.data` strategy which allows you to draw arbitrary data interactively
within the test.
* New "exploded" database format which allows you to more easily check the example
database into a source repository while supporting merging.
* Better management of how examples are saved in the database.
* Health checks will now raise as errors when they fail. It was too easy to have
the warnings be swallowed entirely.

New limitations:

* ``choices()`` and ``streaming()``
strategies may no longer be used with ``find()``. Neither may
:func:`~hypothesis.strategies.data` (this is the change that necessitated a major version bump).

Feature removal:

* The ForkingTestCase executor has gone away. It may return in some more working
form at a later date.

Performance improvements:

* A new model which allows flatmap, composite strategies and stateful testing to
perform *much* better. They should also be more reliable.
* Filtering may in some circumstances have improved significantly. This will
help especially in cases where you have lots of values with individual filters
on them, such as lists(x.filter(...)).
* Modest performance improvements to the general test runner by avoiding expensive
operations

In general your tests should have got faster. If they've instead got significantly
slower, I'm interested in hearing about it.

Data distribution:

The data distribution should have changed significantly. This may uncover bugs the
previous version missed. It may also miss bugs the previous version could have
uncovered. Hypothesis is now producing less strongly correlated data than it used
to, but the correlations are extended over more of the structure.

Shrinking:

Shrinking quality should have improved. In particular Hypothesis can now perform
simultaneous shrinking of separate examples within a single test (previously it
was only able to do this for elements of a single collection). In some cases
performance will have improved, in some cases it will have got worse but generally
shouldn't have by much.


Older versions
==============

2.0.0

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

Codename: A new beginning

This release cleans up all of the legacy that accrued in the course of
Hypothesis 1.0. These are mostly things that were emitting deprecation warnings
in 1.19.0, but there were a few additional changes.

In particular:

* non-strategy values will no longer be converted to strategies when used in
given or find.
* FailedHealthCheck is now an error and not a warning.
* Handling of non-ascii reprs in user types have been simplified by using raw
strings in more places in Python 2.
* given no longer allows mixing positional and keyword arguments.
* given no longer works with functions with defaults.
* given no longer turns provided arguments into defaults - they will not appear
in the argspec at all.
* the basic() strategy no longer exists.
* the n_ary_tree strategy no longer exists.
* the average_list_length setting no longer exists. Note: If you're using
using recursive() this will cause you a significant slow down. You should
pass explicit average_size parameters to collections in recursive calls.
* rule can no longer be applied to the same method twice.
* Python 2.6 and 3.3 are no longer officially supported, although in practice
they still work fine.

This also includes two non-deprecation changes:

* given's keyword arguments no longer have to be the rightmost arguments and
can appear anywhere in the method signature.
* The max_shrinks setting would sometimes not have been respected.

1.19.0

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

Codename: IT COMES

This release heralds the beginning of a new and terrible age of Hypothesis 2.0.

It's primary purpose is some final deprecations prior to said release. The goal
is that if your code emits no warnings under this release then it will probably run
unchanged under Hypothesis 2.0 (there are some caveats to this: 2.0 will drop
support for some Python versions, and if you're using internal APIs then as usual
that may break without warning).

It does have two new features:

* New seed() decorator which allows you to manually seed a test. This may be
harmlessly combined with and overrides the derandomize setting.
* settings objects may now be used as a decorator to fix those settings to a
particular given test.

API changes (old usage still works but is deprecated):

* Settings has been renamed to settings (lower casing) in order to make the
decorator usage more natural.
* Functions for the storage directory that were in hypothesis.settings are now
in a new hypothesis.configuration module.

Additional deprecations:

* the average_list_length setting has been deprecated in favour of being
explicit.
* the basic() strategy has been deprecated as it is impossible to support
it under a Conjecture based model, which will hopefully be implemented at
some point in the 2.x series.
* the n_ary_tree strategy (which was never actually part of the public API)
has been deprecated.
* Passing settings or random as keyword arguments to given is deprecated (use
the new functionality instead)


Bug fixes:

* No longer emit PendingDeprecationWarning for __iter__ and StopIteration in
streaming() values.
* When running in health check mode with non strict, don't print quite so
many errors for an exception in reify.
* When an assumption made in a test or a filter is flaky, tests will now
raise Flaky instead of UnsatisfiedAssumption.

1.18.1

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

Two behind the scenes changes:

* Hypothesis will no longer write generated code to the file system. This
will improve performance on some systems (e.g. if you're using
`PythonAnywhere <https://www.pythonanywhere.com/>`_ which is running your
code from NFS) and prevent some annoying interactions with auto-restarting
systems.
* Hypothesis will cache the creation of some strategies. This can significantly
improve performance for code that uses flatmap or composite and thus has to
instantiate strategies a lot.

Page 183 of 195

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.