Hypothesis

Latest version: v6.122.3

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

Scan your dependencies

Page 207 of 210

0.6.0

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

Codename: I'm sorry, were you using that API?

This is primarily a "simplify all the weird bits of the API" release. As a result there are a lot of breaking changes. If
you just use given with core types then you're probably fine.

In particular:

* Stateful testing has been removed from the API
* The way the database is used has been rendered less useful (sorry). The feature for reassembling values saved from other
tests doesn't currently work. This will probably be brought back in post 1.0.
* SpecificationMapper is no longer a thing. Instead there is an ExtMethod called strategy which you extend to specify how
to convert other types to strategies.
* Settings are now extensible so you can add your own for configuring a strategy
* MappedSearchStrategy no longer needs an unpack method
* Basically all the SearchStrategy internals have changed massively. If you implemented SearchStrategy directly rather than
using MappedSearchStrategy talk to me about fixing it.
* Change to the way extra packages work. You now specify the package. This
must have a load() method. Additionally any modules in the package will be
loaded in under hypothesis.extra

Bug fixes:

* Fix for a bug where calling falsify on a lambda with a non-ascii character
in its body would error.

Hypothesis Extra:

hypothesis-fakefactory\: An extension for using faker data in hypothesis. Depends
on fake-factory.

0.5.0

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

Codename: Read all about it.

Core hypothesis:

* Add support back in for pypy and python 3.2
* given functions can now be invoked with some arguments explicitly provided. If all arguments that hypothesis would have provided are passed in then no falsification is run.
* Related to the above, this means that you can now use pytest fixtures and mark.parametrize with Hypothesis without either interfering with the other.
* Breaking change: given no longer works for functions with varargs (varkwargs are fine). This might be added back in at a later date.
* Windows is now fully supported. A limited version (just the tests with none of the extras) of the test suite is run on windows with each commit so it is now a first class citizen of the Hypothesis world.
* Fix a bug for fuzzy equality of equal complex numbers with different reprs (this can happen when one coordinate is zero). This shouldn't affect users - that feature isn't used anywhere public facing.
* Fix generation of floats on windows and 32-bit builds of python. I was using some struct.pack logic that only worked on certain word sizes.
* When a test times out and hasn't produced enough examples this now raises a Timeout subclass of Unfalsifiable.
* Small search spaces are better supported. Previously something like a given(bool, bool) would have failed because it couldn't find enough examples. Hypothesis is now aware of the fact that these are small search spaces and will not error in this case.
* Improvements to parameter search in the case of hard to satisfy assume. Hypothesis will now spend less time exploring parameters that are unlikely to provide anything useful.
* Increase chance of generating "nasty" floats
* Fix a bug that would have caused unicode warnings if you had a sampled_from that was mixing unicode and byte strings.
* Added a standard test suite that you can use to validate a custom strategy you've defined is working correctly.

Hypothesis extra:

First off, introducing Hypothesis extra packages!

These are packages that are separated out from core Hypothesis because they have one or more dependencies. Every
hypothesis-extra package is pinned to a specific point release of Hypothesis and will have some version requirements
on its dependency. They use entry_points so you will usually not need to explicitly import them, just have them installed
on the path.

This release introduces two of them:

hypothesis-datetime:

Does what it says on the tin: Generates datetimes for Hypothesis. Just install the package and datetime support will start
working.

Depends on pytz for timezone support

hypothesis-pytest:

A very rudimentary pytest plugin. All it does right now is hook the display of falsifying examples into pytest reporting.

Depends on pytest.

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.

Page 207 of 210

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.