./devel/py-hypothesis, Python library for property based testing

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]

Branch: CURRENT, Version: 4.33.1, Package name: py37-hypothesis-4.33.1, Maintainer: pkgsrc-users

Hypothesis is a library for testing your Python code against a much
larger range of examples than you would ever want to write by hand.
It's based on the Haskell library, Quickcheck, and is designed to
integrate seamlessly into your existing Python unit testing work

Hypothesis is both extremely practical and also advances the state
of the art of unit testing by some way. It's easy to use, stable,
and extremely powerful. If you're not using Hypothesis to test your
project then you're missing out.

Required to run:
[devel/py-setuptools] [devel/py-attrs] [lang/python37]

Required to build:

Master sites:

SHA1: 81f91edf5c56c3b83b724dbe171be33414adcc1c
RMD160: 3a8aa39f23171d67b0f6ff2a156725f5d74b218e
Filesize: 204.032 KB

Version history: (Expand)

CVS history: (Expand)

   2019-08-22 13:05:27 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-hypothesis: updated to 4.33.1

This patch works around a crash when an incompatible version of Numpy
is installed under PyPy 5.10 (Python 2.7).

If you are still using Python 2, please upgrade to Python 3 as soon
as possible - it will be unsupported at the end of this year.

This release improves the :func:~hypothesis.provisional.domains
strategy, as well as the :func:~hypothesis.provisional.urls and
the :func:~hypothesis.strategies.emails strategies which use it.
These strategies now use the full IANA list of Top Level Domains
and are correct as per :rfc:1035.

Passing tests using these strategies may now fail.

This patch tidies up the repr of several settings-related objects,
at runtime and in the documentation, and deprecates the undocumented
edge case that phases=None was treated like phases=tuple(Phase).

It *also* fixes :func:~hypothesis.extra.lark.from_lark with
:pypi:lark 0.7.2 <lark-parser> and later.

This patch updates some internal comments for :pypi:mypy 0.720.
There is no user-visible impact.

This release changes how the shrinker represents its progress internally. For \ 
large generated test cases
this should result in significantly less memory usage and possibly faster \ 
shrinking. Small generated
test cases may be slightly slower to shrink but this shouldn't be very noticeable.

This release makes :func:~hypothesis.extra.numpy.arrays more pedantic about
elements strategies that cannot be exactly represented as array elements.

In practice, you will see new warnings if you were using a float16 or
float32 dtype without passing :func:~hypothesis.strategies.floats the
width=16 or width=32 arguments respectively.

The previous behaviour could lead to silent truncation, and thus some elements
being equal to an explicitly excluded bound (:issue:1899).

This patch changes an internal use of MD5 to SHA hashes, to better support
users subject to FIPS-140.  There is no user-visible or API change.

This release simplifies the logic of the :attr:~hypothesis.settings.print_blob \ 
setting by removing the option to set it to PrintSettings.INFER.
As a result the print_blob setting now takes a single boolean value, and the use \ 
of PrintSettings is deprecated.

This patch improves the docstrings of several Hypothesis strategies, by
clarifying markup and adding cross-references.  There is no runtime change.

This patch improves the behaviour of the :func:~hypothesis.strategies.text
strategy when passed an alphabet which is not a strategy.  The value is
now interpreted as whitelist_characters to :func:~hypothesis.strategies.characters
instead of a sequence for :func:~hypothesis.strategies.sampled_from, which
standardises the distribution of examples and the shrinking behaviour.

You can get the previous behaviour by using
lists(sampled_from(alphabet)).map("".map) instead.

This release deprecates find().  The .example() method is a better
replacement if you want *an* example, and for the rare occasions where you
want the *minimal* example you can get it from :func:@given <hypothesis.given>.

:func:@given <hypothesis.given> has steadily outstripped find() in both
features and performance over recent years, and as we do not have the resources
to maintain and test both we think it is better to focus on just one.

This release refactors the implementation of the .example() method,
to more accurately represent the data which will be generated by
:func:@given <hypothesis.given>.

As a result, calling s.example() on an empty strategy s
(such as :func:~hypothesis.strategies.nothing) now raises Unsatisfiable
instead of the old NoExamples exception.

This patch ensures that the Pandas extra will keep working when Python 3.8
removes abstract base classes from the top-level :obj:python:collections
namespace.  This also fixes the relevant warning in Python 3.7, but there
is no other difference in behaviour and you do not need to do anything.

This release fixes  :issue:2027, by changing the way Hypothesis tries to \ 
generate distinct examples to be more efficient.

This may result in slightly different data distribution, and should improve \ 
generation performance in general,
but should otherwise have minimal user impact.

This release fixes :issue:1864, where some simple tests would perform very slowly,
because they would run many times with each subsequent run being progressively \ 
They will now stop after a more reasonable number of runs without hitting this \ 

Unless you are hitting exactly this issue, it is unlikely that this release will \ 
have any effect,
but certain classes of custom generators that are currently very slow may become \ 
a bit faster,
or start to trigger health check failures.

This release adds the strategy :func:~hypothesis.extra.numpy.integer_array_indices,
which generates tuples of Numpy arrays that can be used for
advanced indexing \ 
to select an array of a specified shape.

This release significantly improves the performance of drawing unique \ 
collections whose
elements are drawn from  :func:~hypothesis.strategies.sampled_from  strategies.

As a side effect, this detects an error condition that would previously have
passed silently: When the min_size argument on a collection with distinct elements
is greater than the number of elements being sampled, this will now raise an error.

This release removes some defunct internal functionality that was only being used
for testing. It should have no user visible impact.

This release deprecates and disables the buffer_size setting,
which should have been treated as a private implementation detail
all along.  We recommend simply deleting this settings argument.

This patch makes :func:~hypothesis.strategies.datetimes more efficient,
as it now handles short months correctly by construction instead of filtering.

This patch improves the development experience by simplifying the tracebacks
you will see when e.g. you have used the .map(...) method of a strategy
and the mapped function raises an exception.

No new exceptions can be raised, nor existing exceptions change anything but
their traceback.  We're simply using if-statements rather than exceptions for
control flow in a certain part of the internals!

This patch fixes :issue:2014, where our compatibility layer broke with version
3.7.4 of the :pypi:typing module backport on PyPI.

This issue only affects Python 2.  We remind users that Hypothesis, like many other
packages, will drop Python 2 support on 2020-01-01 \ 
and already has several features that are only available on Python 3.

This patch improves the implementation of an internal wrapper on Python 3.8
beta1 (and will break on the alphas; but they're not meant to be stable).
On other versions, there is no change at all.
   2019-06-12 11:51:52 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-hypothesis: updated to 4.24.3

This patch improves the implementation of an internal wrapper on Python 3.8 \ 
beta1 (and will break on the alphas; but they're not meant to be stable). On \ 
other versions, there is no change at all.

Deprecation messages for functions in hypothesis.extra.django.models now \ 
explicitly name the deprecated function to make it easier to track down usages. \ 
Thanks to Kristian Glass for this contribution!

This patch fixes :issue:`1999`, a spurious bug raised when a \ 
:func:`@st.composite <hypothesis.strategies.composite>` function was \ 
passed a keyword-only argument.
   2019-06-02 10:30:19 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-hypothesis: updated to 4.24.0

This release deprecates GenericStateMachine, in favor of \ 
:class:~hypothesis.stateful.RuleBasedStateMachine. Rule-based stateful testing \ 
is significantly faster, especially during shrinking.

If your use-case truly does not fit rule-based stateful testing, we recommend \ 
writing a custom test function which drives your specific control-flow using \ 

This patch fixes a very rare example database issue with file permissions.

When running a test that uses both :func:@given <hypothesis.given> and \ 
pytest.mark.parametrize, using :pypi:pytest-xdist on Windows, with failing \ 
examples in the database, two attempts to read a file could overlap and we \ 
caught FileNotFound but not other OSErrors.

This patch has a minor cleanup of the internal engine. There is no user-visible \ 

This patch clarifies some error messages when the test function signature is \ 
incompatible with the arguments to :func:@given <hypothesis.given>, \ 
especially when the :obj:@settings() <hypothesis.settings> decorator is \ 
also used (:issue:1978).

This release adds the :pypi:pyupgrade fixer to our code style, for consistent \ 
use of dict and set literals and comprehensions.

This release slightly simplifies a small part of the core engine. There is no \ 
user-visible change.
   2019-05-09 13:53:58 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-hypothesis: updated to 4.23.4

Fixes a minor formatting issue the docstring of from_type()

Adds a recipe to the docstring of from_type() that describes a means for drawing \ 
values for “everything except” a specified type. This recipe is especially \ 
useful for writing tests that perform input-type validation.

This patch uses autoflake to remove some pointless pass statements, which \ 
improves our workflow but has no user-visible impact.

This patch fixes an OverflowError in from_type(xrange) on Python 2.

It turns out that not only do the start and stop values have to fit in a C long, \ 
but so does stop - start. We now handle this even on 32bit platforms, but remind \ 
users that Python2 will not be supported after 2019 without specific funding.

This release implements the slices() strategy, to generate slices of a \ 
length-size sequence.

This patch exposes DataObject, solely to support more precise type hints. \ 
Objects of this type are provided by data(), and can be used to draw examples \ 
from strategies intermixed with your test code.

This patch fixes the very rare issue 1798 in array_dtypes(), which caused an \ 
internal error in our tests.

This patch fixes a rare bug in from_type(range).

The unique_by argument to lists now accepts a tuple of callables such that every \ 
element of the generated list will be unique with respect to each callable in \ 
the tuple.

This patch cleans up the internals of one_of(). You may see a slight change to \ 
the distribution of examples from this strategy but there is no change to the \ 
public API.

The from_type() strategy now supports slice objects.

This release improves the array_shapes() strategy, to choose an appropriate \ 
default for max_side based on the min_side, and max_dims based on the min_dims. \ 
An explicit error is raised for dimensions greater than 32, which are not \ 
supported by Numpy, as for other invalid combinations of arguments.

The from_type() strategy now supports range objects (or xrange on Python 2).

This release fixes a very rare edge case in the test-case mutator, which could \ 
cause an internal error with certain unusual tests.

This patch makes Hypothesis compatible with the Python 3.8 alpha, which changed \ 
the representation of code objects to support positional-only arguments. Note \ 
however that Hypothesis does not (yet) support such functions as e.g. arguments \ 
to builds() or inputs to @given.

This patch improves the performance of unique collections such as sets() when \ 
the elements are drawn from a sampled_from() strategy.

This release adds the functions() strategy, which can be used to imitate your \ 
‘real’ function for callbacks.

This release refactors stateful rule selection to share the new machinery with \ 
sampled_from() instead of using the original independent implementation.

This patch allows Hypothesis to try a few more examples after finding the first \ 
bug, in hopes of reporting multiple distinct bugs. The heuristics described in \ 
issue 847 ensure that we avoid wasting time on fruitless searches, while still \ 
surfacing each bug as soon as possible.
   2019-04-16 09:14:00 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-hypothesis: updated to 4.17.0

This release adds the strategy \ 
:func:~hypothesis.extra.numpy.broadcastable_shapes, which generates array shapes \ 
that are broadcast-compatible with a provided shape.

This release allows :func:~hypothesis.strategies.register_type_strategy to be \ 
used with :obj:python:typing.NewType instances. This may be useful to e.g. \ 
provide only positive integers for :func:from_type(UserId) \ 
<hypothesis.strategies.from_type> with a UserId = NewType('UserId', int) \ 

This release supports passing a :class:~python:datetime.timedelta as the \ 
:obj:~hypothesis.settings.deadline setting, so you no longer have to remember \ 
that the number is in milliseconds (:issue:1900).

Thanks to Damon Francisco for this change!

This patch makes the type annotations on hypothesis.extra.dateutil compatible \ 
with :pypi:mypy 0.700.

This release fixes a bug introduced in :ref:Hypothesis 4.14.3 <v4.14.3> \ 
that would sometimes cause :func:sampled_from(...).filter(...) \ 
<hypothesis.strategies.sampled_from> to encounter an internal assertion \ 
failure when there are three or fewer elements, and every element is rejected by \ 
the filter.

This patch takes the previous efficiency improvements to \ 
:func:sampled_from(...).filter(...) <hypothesis.strategies.sampled_from> \ 
strategies that reject most elements, and generalises them to also apply to \ 
sampled_from(...).filter(...).filter(...) and longer chains of filters.

This release fixes a bug that prevented \ 
:func:~hypothesis.strategies.random_module from correctly restoring the previous \ 
state of the random module.

The random state was instead being restored to a temporary deterministic state, \ 
which accidentally caused subsequent tests to see the same random values across \ 
multiple test runs.

This patch adds an internal special case to make \ 
:func:sampled_from(...).filter(...) <hypothesis.strategies.sampled_from> \ 
much more efficient when the filter rejects most elements
   2019-04-02 11:40:30 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-hypothesis: updated to 4.14.2

This patch improves the error message if the function f in :ref:s.flatmap(f) \ 
<flatmap> does not return a strategy.

This release modifies how Hypothesis selects operations to run during shrinking, \ 
by causing it to deprioritise previously useless classes of shrink until others \ 
have reached a fixed point.

This avoids certain pathological cases where the shrinker gets very close to \ 
finishing and then takes a very long time to finish the last small changes \ 
because it tries many useless shrinks for each useful one towards the end. It \ 
also should cause a more modest improvement (probably no more than about 30%) in \ 
shrinking performance for most tests.

This release blocks installation of Hypothesis on Python 3.4, which :PEP:reached \ 
its end of life date on 2019-03-18 <429>.

This should not be of interest to anyone but downstream maintainers - if you are \ 
affected, migrate to a secure version of Python as soon as possible or at least \ 
seek commercial support.

This release makes it an explicit error to call :func:floats(min_value=inf, \ 
exclude_min=True) <hypothesis.strategies.floats> or \ 
:func:floats(max_value=-inf, exclude_max=True) \ 
<hypothesis.strategies.floats>, as there are no possible values that can \ 
be generated (:issue:1859).

:func:floats(min_value=0.0, max_value=-0.0) <hypothesis.strategies.floats> \ 
is now deprecated. While 0. == -0. and we could thus generate either if \ 
comparing by value, violating the sequence ordering of floats is a special case \ 
we don't want or need.

This release should significantly reduce the amount of memory that Hypothesis \ 
uses for representing large test cases, by storing information in a more compact \ 
representation and only unpacking it lazily when it is first needed.

This update adds the :obj:~hypothesis.settings.report_multiple_bugs setting, \ 
which you can use to disable multi-bug reporting and only raise whichever bug \ 
had the smallest minimal example. This is occasionally useful when using a \ 
debugger or tools that annotate tracebacks via introspection.

This change makes a tiny improvement to the core engine's bookkeeping. There is \ 
no user-visible change.

This release changes some of Hypothesis's internal shrinking behaviour in order \ 
to reduce memory usage and hopefully improve performance.

This release adds a micro-optimisation to how Hypothesis handles debug reporting \ 
internally. Hard to shrink test may see a slight performance improvement, but in \ 
most common scenarios it is unlikely to be noticeable.

This release removes some redundant code that was no longer needed but was still \ 
running a significant amount of computation and allocation on the hot path. This \ 
should result in a modest speed improvement for most tests, especially those \ 
with large test cases.

This release adds a micro-optimisation to how Hypothesis caches test cases. This \ 
will cause a small improvement in speed and memory usage for large test cases, \ 
but in most common scenarios it is unlikely to be noticeable.

This release removes some internal code that populates a field that is no longer \ 
used anywhere. This should result in some modest performance and speed \ 
improvements and no other user visible effects.
   2019-03-13 09:51:48 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-hypothesis: updated to 4.11.1

This is a formatting-only patch, enabled by a new version of :pypi:isort.

This release deprecates :func:~hypothesis.strategies.sampled_from with empty \ 
sequences. This returns :func:~hypothesis.strategies.nothing, which gives a \ 
clear error if used directly... but simply vanishes if combined with another \ 

Tests that silently generate less than expected are a serious problem for anyone \ 
relying on them to find bugs, and we think reliability more important than \ 
convenience in this case.

This release improves Hypothesis's to detect flaky tests, by noticing when the \ 
behaviour of the test changes between runs. In particular this will notice many \ 
new cases where data generation depends on external state (e.g. external sources \ 
of randomness) and flag those as flaky sooner and more reliably.

The basis of this feature is a considerable reengineering of how Hypothesis \ 
stores its history of test cases, so on top of this its memory usage should be \ 
considerably reduced.

This release adds the strategy :func:~hypothesis.extra.numpy.valid_tuple_axes, \ 
which generates tuples of axis-indices that can be passed to the axis argument \ 
in NumPy's sequential functions (e.g. :func:numpy:numpy.sum).

This release significantly tightens validation in :class:hypothesis.settings. \ 
:obj:~hypothesis.settings.max_examples, :obj:~hypothesis.settings.buffer_size, \ 
and :obj:~hypothesis.settings.stateful_step_count must be positive integers; \ 
:obj:~hypothesis.settings.deadline must be a positive number or None; and \ 
:obj:~hypothesis.settings.derandomize must be either True or False.

As usual, this replaces existing errors with a more helpful error and starts new \ 
validation checks as deprecation warnings.

This release makes some micro-optimisations to certain calculations performed in \ 
the shrinker. These should particularly speed up large test cases where the \ 
shrinker makes many small changes. It will also reduce the amount allocated, but \ 
most of this is garbage that would have been immediately thrown away, so you \ 
probably won't see much effect specifically from that.

This patch removes some overhead from :func:~hypothesis.extra.numpy.arrays with \ 
a constant shape and dtype. The resulting performance improvement is modest, but \ 
worthwile for small arrays.
   2019-03-02 15:22:10 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-hypothesis: updated to 4.7.17

This release makes some micro-optimisations within Hypothesis's internal \ 
representation of test cases. This should cause heavily nested test cases to \ 
allocate less during generation and shrinking, which should speed things up \ 

This changes the order in which Hypothesis runs certain operations during \ 
shrinking. This should significantly decrease memory usage and speed up \ 
shrinking of large examples.

This release allows Hypothesis to calculate a number of attributes of generated \ 
test cases lazily. This should significantly reduce memory usage and modestly \ 
improve performance, especially for large test cases.

This release reduces the number of operations the shrinker will try when \ 
reordering parts of a test case. This should in some circumstances significantly \ 
speed up shrinking. It may result in different final test cases, and if so \ 
usually slightly worse ones, but it should not generally have much impact on the \ 
end result as the operations removed were typically useless.

This release changes how Hypothesis reorders examples within a test case during \ 
shrinking. This should make shrinking considerably faster.

This release slightly improves the shrinker's ability to replace parts of a test \ 
case with their minimal version, by allowing it to do so in bulk rather than one \ 
at a time. Where this is effective, shrinker performance should be modestly \ 

This release makes some micro-optimisations to common operations performed \ 
during shrinking. Shrinking should now be slightly faster, especially for large \ 
examples with relatively fast test functions.

This release is a purely internal refactoring of Hypothesis's API for \ 
representing test cases. There should be no user visible effect.

This release changes certain shrink passes to make them more efficient when they \ 
aren't making progress.

This patch removes some unused code, which makes the internals a bit easier to \ 
understand. There is no user-visible impact.

This release reduces the number of operations the shrinker will try when \ 
reordering parts of a test case. This should in some circumstances significantly \ 
speed up shrinking. It may result in different final test cases, and if so \ 
usually slightly worse ones, but it should not generally have much impact on the \ 
end result as the operations removed were typically useless.

This patch removes some unused code from the shrinker. There is no user-visible \ 

This release changes certain shrink passes to make them adaptive - that is, in \ 
cases where they are successfully making progress they may now do so \ 
significantly faster.

This is a docs-only patch, noting that because the :pypi:lark-parser is under \ 
active development at version 0.x, hypothesis[lark] APIs may break in minor \ 
releases if necessary to keep up with the upstream package.

This changes Hypothesis to no longer import various test frameworks by default \ 
(if they are installed). which will speed up the initial import hypothesis call.

This release changes Hypothesis's internal representation of a test case to \ 
calculate some expensive structural information on demand rather than eagerly. \ 
This should reduce memory usage a fair bit, and may make generation somewhat \ 

This release refactors the internal representation of previously run test cases. \ 
The main thing you should see as a result is that Hypothesis becomes somewhat \ 
less memory hungry.

This patch allows :func:~hypothesis.extra.numpy.array_shapes to generate shapes \ 
with side-length or even dimension zero, though the minimum still defaults to \ 
one. These shapes are rare and have some odd behavior, but are particularly \ 
important to test for just that reason!

In a related bigfix, :func:~hypothesis.extra.numpy.arrays now supports \ 
generating zero-dimensional arrays with dtype=object and a strategy for iterable \ 
elements. Previously, the array element would incorrectly be set to the first \ 
item in the generated iterable.