Hypothesis

Latest version: v6.99.13

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

Scan your dependencies

Page 124 of 194

4.1.0

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

This release adds :func:`~hypothesis.register_random`, which registers
``random.Random`` instances or compatible objects to be seeded and reset
by Hypothesis to ensure that test cases are deterministic.

We still recommend explicitly passing a ``random.Random`` instance from
:func:`~hypothesis.strategies.randoms` if possible, but registering a
framework-global state for Hypothesis to manage is better than flaky tests!

4.0.2

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

This patch fixes :issue:`1387`, where bounded :func:`~hypothesis.strategies.integers`
with a very large range would almost always generate very large numbers.
Now, we usually use the same tuned distribution as unbounded
:func:`~hypothesis.strategies.integers`.

4.0.1

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

This release randomizes the order in which the shrinker tries some of its initial normalization operations.
You are unlikely to see much difference as a result unless your generated examples are very large.
In this case you may see some performance improvements in shrinking.

4.0.0

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

Welcome to the next major version of Hypothesis!

There are no new features here, as we release those in minor versions.
Instead, 4.0 is a chance for us to remove deprecated features (many already
converted into no-ops), and turn a variety of warnings into errors.

If you were running on the last version of Hypothesis 3.x *without any
Hypothesis deprecation warnings* (or using private APIs), this will be
a very boring upgrade. **In fact, nothing will change for you at all.**
Per :ref:`our deprecation policy <deprecation-policy>`, warnings added in
the last six months (after 2018-07-05) have not been converted to errors.


Removals
~~~~~~~~
- ``hypothesis.extra.datetime`` has been removed, replaced by the core
date and time strategies.
- ``hypothesis.extra.fakefactory`` has been removed, replaced by general
expansion of Hypothesis' strategies and the third-party ecosystem.
- The SQLite example database backend has been removed.

Settings
~~~~~~~~
- The :obj:`~hypothesis.settings.deadline` is now enforced by default, rather than just
emitting a warning when the default (200 milliseconds per test case) deadline is exceeded.
- The ``database_file`` setting has been removed; use :obj:`~hypothesis.settings.database`.
- The ``perform_health_check`` setting has been removed; use
:obj:`~hypothesis.settings.suppress_health_check`.
- The ``max_shrinks`` setting has been removed; use :obj:`~hypothesis.settings.phases`
to disable shrinking.
- The ``min_satisfying_examples``, ``max_iterations``, ``strict``, ``timeout``, and
``use_coverage`` settings have been removed without user-configurable replacements.

Strategies
~~~~~~~~~~
- The ``elements`` argument is now required for collection strategies.
- The ``average_size`` argument was a no-op and has been removed.
- Date and time strategies now only accept ``min_value`` and ``max_value`` for bounds.
- :func:`~hypothesis.strategies.builds` now requires that the thing to build is
passed as the first positional argument.
- Alphabet validation for :func:`~hypothesis.strategies.text` raises errors, not warnings,
as does category validation for :func:`~hypothesis.strategies.characters`.
- The ``choices()`` strategy has been removed. Instead, you can use
:func:`~hypothesis.strategies.data` with :func:`~hypothesis.strategies.sampled_from`,
so ``choice(elements)`` becomes ``data.draw(sampled_from(elements))``.
- The ``streaming()`` strategy has been removed. Instead, you can use
:func:`~hypothesis.strategies.data` and replace iterating over the stream with
``data.draw()`` calls.
- :func:`~hypothesis.strategies.sampled_from` and :func:`~hypothesis.strategies.permutations`
raise errors instead of warnings if passed a collection that is not a sequence.

Miscellaneous
~~~~~~~~~~~~~
- Applying :func:`given <hypothesis.given>` to a test function multiple times
was really inefficient, and now it's also an error.
- Using the ``.example()`` method of a strategy (intended for interactive
exploration) within another strategy or a test function always weakened
data generation and broke shrinking, and now it's an error too.
- The ``HYPOTHESIS_DATABASE_FILE`` environment variable is no longer
supported, as the ``database_file`` setting has been removed.
- The ``HYPOTHESIS_VERBOSITY_LEVEL`` environment variable is no longer
supported. You can use the ``--hypothesis-verbosity`` pytest argument instead,
or write your own setup code using the settings profile system to replace it.
- Using :func:`seed <hypothesis.seed>` or
:obj:`derandomize=True <hypothesis.settings.derandomize>` now forces
:obj:`database=None <hypothesis.settings.database>` to ensure results
are in fact reproducible. If :obj:`~hypothesis.settings.database` is
*not* ``None``, doing so also emits a ``HypothesisWarning``.
- Unused exception types have been removed from ``hypothesis.errors``;
namely ``AbnormalExit``, ``BadData``, ``BadTemplateDraw``,
``DefinitelyNoSuchExample``, ``Timeout``, and ``WrongFormat``.


Hypothesis 3.x
==============

3.88.3

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

This changes the order that the shrinker tries certain operations in its "emergency" phase which runs late in the process.
The new order should be better at avoiding long stalls where the shrinker is failing to make progress,
which may be helpful if you have difficult to shrink test cases.
However this will not be noticeable in the vast majority of use cases.

3.88.2

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

This is a pure refactoring release that extracts some logic from the core Hypothesis engine
into its own class and file. It should have no user visible impact.

Page 124 of 194

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.