github HypothesisWorks/hypothesis hypothesis-python-5.0.0
Hypothesis for Python - version 5.0.0

latest releases: hypothesis-python-6.102.4, hypothesis-python-6.102.3, hypothesis-python-6.102.2...
4 years ago

Welcome to the next major version of Hypothesis!

There are no new features here, as we release those in minor versions.
Instead, 5.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 4.x without any
Hypothesis deprecation warnings
, this will be a very boring upgrade.
In fact, nothing will change for you at all.

Note: This release drops support for Python 2, which has passed its
end of life date. The Python 3 Statement outlines our reasons, and
lists many other packages that have made the same decision."pip
install hypothesis" should continue to give you the latest
compatible version. If you have somehow ended up with Hypothesis 5.0
on Python 2, you need to update your packaging stack to "pip >= 9.0"
and "setuptools >= 24.2" - see here for details. Then "pip uninstall
hypothesis && pip install hypothesis" will get you back to a
compatible version.

Strategies


* "integers()" bounds must be equal to an integer, though they can
  still be other types.

* If "fractions()" is passed a "max_denominator", the bounds must
  have at most that denominator.

* "floats()" bounds must be exactly representable as a floating-
  point number with the given "width".  If not, the error message
  includes the nearest such number.

* "sampled_from([])" is now an error.

* The values from the "elements" and "fill" strategies for
  "hypothesis.extra.numpy.arrays()" must be losslessly representable
  in an array of the given dtype.

* The "min_size" and "max_size" arguments to all collection
  strategies must be of type "int" (or "max_size" may be "None").


Miscellaneous
  • The ".example()" method of strategies (intended for interactive
    exploration) no longer takes a "random" argument.

  • You may pass either the "target" or "targets" argument to stateful
    rules, but not both.

  • "deadline" must be "None" (to disable), a "timedelta", or an
    integer or float number of milliseconds.

  • Both of "derandomize" and "print_blob" must be either "True" or
    "False", where they previously accepted other values.

  • "stateful_step_count" must be at least one.

  • "max_examples" must be at least one. To disable example
    generation, use the "phases" setting.

Removals


* "hypothesis.stateful.GenericStateMachine" in favor of
  "hypothesis.stateful.RuleBasedStateMachine"

* "hypothesis.extra.django.models.models" in favor of
  "hypothesis.extra.django.from_model()" and
  "hypothesis.extra.django.models.add_default_field_mapping" in favor
  of "hypothesis.extra.django.register_field_strategy()"

* "hypothesis.HealthCheck.hung_test", without replacement

* "hypothesis.settings.buffer", without replacement

* "hypothesis.PrintSettings", because
  "hypothesis.settings.print_blob" takes "True" or "False"

* "hypothesis.settings.timeout", in favor of
  "hypothesis.settings.deadline"

* "hypothesis.unlimited" without replacement (only only useful as
  argument to "timeout")


Hypothesis 4.x
==============

*[The canonical version of these notes (with links) is on readthedocs.](https://hypothesis.readthedocs.io/en/latest/changes.html#v5-0-0)*

Don't miss a new hypothesis release

NewReleases is sending notifications on new releases.