Hypothesis

Latest version: v6.118.8

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

Scan your dependencies

Page 205 of 208

0.4.3

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

Codename: TIL narrow Python builds are a thing

This just fixes the one bug.

* Apparently there is such a thing as a "narrow python build" and OS X ships with these by default
for python 2.7. These are builds where you only have two bytes worth of unicode. As a result,
generating unicode was completely broken on OS X. Fix this by only generating unicode codepoints
in the range supported by the system.

0.4.2

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

Codename: O(dear)

This is purely a bugfix release:

* Provide sensible external hashing for all core types. This will significantly improve
performance of tracking seen examples which happens in literally every falsification
run. For Hypothesis fixing this cut 40% off the runtime of the test suite. The behaviour
is quadratic in the number of examples so if you're running the default configuration
this will be less extreme (Hypothesis's test suite runs at a higher number of examples
than default), but you should still see a significant improvement.
* Fix a bug in formatting of complex numbers where the string could get incorrectly truncated.

0.4.1

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

Codename: Cruel and unusual edge cases

This release is mostly about better test case generation.

Enhancements:

* Has a cool release name
* text_type (str in python 3, unicode in python 2) example generation now
actually produces interesting unicode instead of boring ascii strings.
* floating point numbers are generated over a much wider range, with particular
attention paid to generating nasty numbers - nan, infinity, large and small
values, etc.
* examples can be generated using pieces of examples previously saved in the
database. This allows interesting behaviour that has previously been discovered
to be propagated to other examples.
* improved parameter exploration algorithm which should allow it to more reliably
hit interesting edge cases.
* Timeout can now be disabled entirely by setting it to any value <= 0.


Bug fixes:

* The descriptor on a OneOfStrategy could be wrong if you had descriptors which
were equal but should not be coalesced. e.g. a strategy for one_of((frozenset({int}), {int}))
would have reported its descriptor as {int}. This is unlikely to have caused you
any problems
* If you had strategies that could produce NaN (which float previously couldn't but
e.g. a Just(float('nan')) could) then this would have sent hypothesis into an infinite
loop that would have only been terminated when it hit the timeout.
* Given elements that can take a long time to minimize, minimization of floats or tuples
could be quadratic or worse in the that value. You should now see much better performance
for simplification, albeit at some cost in quality.

Other:

* A lot of internals have been been rewritten. This shouldn't affect you at all, but
it opens the way for certain of hypothesis's oddities to be a lot more extensible by
users. Whether this is a good thing may be up for debate...

0.4.0

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

FLAGSHIP FEATURE: Hypothesis now persists examples for later use. It stores
data in a local SQLite database and will reuse it for all tests of the same
type.

LICENSING CHANGE: Hypothesis is now released under the Mozilla Public License
2.0. This applies to all versions from 0.4.0 onwards until further notice.
The previous license remains applicable to all code prior to 0.4.0.

Enhancements:

* Printing of failing examples. I was finding that the pytest runner was not
doing a good job of displaying these, and that Hypothesis itself could do
much better.
* Drop dependency on six for cross-version compatibility. It was easy
enough to write the shim for the small set of features that we care about
and this lets us avoid a moderately complex dependency.
* Some improvements to statistical distribution of selecting from small (<=
3 elements)
* Improvements to parameter selection for finding examples.

Bugs fixed:

* could_have_produced for lists, dicts and other collections would not have
examined the elements and thus when using a union of different types of
list this could result in Hypothesis getting confused and passing a value
to the wrong strategy. This could potentially result in exceptions being
thrown from within simplification.
* sampled_from would not work correctly on a single element list.
* Hypothesis could get *very* confused by values which are
equal despite having different types being used in descriptors. Hypothesis
now has its own more specific version of equality it uses for descriptors
and tracking. It is always more fine grained than Python equality: Things
considered != are not considered equal by hypothesis, but some things that
are considered == are distinguished. If your test suite uses both frozenset
and set tests this bug is probably affecting you.

0.3.2

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

* Fix a bug where if you specified floats_in_range with integer arguments
Hypothesis would error in example simplification.
* Improve the statistical distribution of the floats you get for the
floats_in_range strategy. I'm not sure whether this will affect users in
practice but it took my tests for various conditions from flaky to rock
solid so it at the very least improves discovery of the artificial cases
I'm looking for.
* Improved repr() for strategies and RandomWithSeed instances.
* Add detection for flaky test cases where hypothesis managed to find an
example which breaks it but on the final invocation of the test it does
not raise an error. This will typically happen with too much recursion
errors but could conceivably happen in other circumstances too.
* Provide a "derandomized" mode. This allows you to run hypothesis with
zero real randomization, making your build nice and deterministic. The
tests run with a seed calculated from the function they're testing so you
should still get a good distribution of test cases.
* Add a mechanism for more conveniently defining tests which just sample
from some collection.
* Fix for a really subtle bug deep in the internals of the strategy table.
In some circumstances if you were to define instance strategies for both
a parent class and one or more of its subclasses you would under some
circumstances get the strategy for the wrong superclass of an instance.
It is very unlikely anyone has ever encountered this in the wild, but it
is conceivably possible given that a mix of namedtuple and tuple are used
fairly extensively inside hypothesis which do exhibit this pattern of
strategy.

0.3.1

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

* Support for generation of frozenset and Random values
* Correct handling of the case where a called function mutates it argument.
This involved introducing a notion of a strategies knowing how to copy
their argument. The default method should be entirely acceptable and the
worst case is that it will continue to have the old behaviour if you
don't mark your strategy as mutable, so this shouldn't break anything.
* Fix for a bug where some strategies did not correctly implement
could_have_produced. It is very unlikely that any of these would have
been seen in the wild, and the consequences if they had been would have
been minor.
* Re-export the given decorator from the main hypothesis namespace. It's
still available at the old location too.
* Minor performance optimisation for simplifying long lists.

Page 205 of 208

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.