Hello community, here is the log from the commit of package python-hypothesis for openSUSE:Factory checked in at 2018-12-14 20:47:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-hypothesis (Old) and /work/SRC/openSUSE:Factory/.python-hypothesis.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hypothesis" Fri Dec 14 20:47:53 2018 rev:31 rq:656754 version:3.82.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-hypothesis/python-hypothesis.changes 2018-11-06 14:01:35.655671205 +0100 +++ /work/SRC/openSUSE:Factory/.python-hypothesis.new.28833/python-hypothesis.changes 2018-12-14 20:47:57.261462615 +0100 @@ -1,0 +2,26 @@ +Sat Dec 8 19:35:13 UTC 2018 - Arun Persaud <[email protected]> + +- update to version 3.82.5: + * This patch fixes issue #1667, where passing bounds of Numpy dtype + int64 to integers() could cause errors on Python 3 due to internal + rounding. + +- changes from version 3.82.4: + * Hypothesis now seeds and resets the global state of np.random for + each test case, to ensure that tests are reproducible. + * This matches and complements the existing handling of the random + module - Numpy simply maintains an independent PRNG for + performance reasons. + +- changes from version 3.82.3 : + * This is a no-op release to add the new Framework :: Hypothesis + trove classifier to hypothesis on PyPI. + * You can use it as a filter to find Hypothesis-related packages + such as extensions as they add the tag over the coming weeks, or + simply visit our curated list. + +- changes from version 3.82.2 : + * The Hypothesis for Pandas extension is now listed in setup.py, so + you can pip install hypothesis[pandas]. + +------------------------------------------------------------------- Old: ---- hypothesis-python-3.82.1.tar.gz New: ---- hypothesis-python-3.82.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-hypothesis.spec ++++++ --- /var/tmp/diff_new_pack.RLeQa5/_old 2018-12-14 20:47:58.729460594 +0100 +++ /var/tmp/diff_new_pack.RLeQa5/_new 2018-12-14 20:47:58.765460545 +0100 @@ -30,7 +30,7 @@ %bcond_with test %endif %bcond_without python2 -Version: 3.82.1 +Version: 3.82.5 Release: 0 Summary: A library for property based testing License: MPL-2.0 ++++++ hypothesis-python-3.82.1.tar.gz -> hypothesis-python-3.82.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/.circleci/config.yml new/hypothesis-hypothesis-python-3.82.5/.circleci/config.yml --- old/hypothesis-hypothesis-python-3.82.1/.circleci/config.yml 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/.circleci/config.yml 2018-12-08 15:00:43.000000000 +0100 @@ -7,15 +7,6 @@ - checkout - run: brew update - run: brew install readline xz ncurses - - restore_cache: - keys: - - v4-runtimes- - run: ./build.sh install-core - run: ./build.sh check-py27 - run: ./build.sh check-py36 - - save_cache: - key: v4-runtimes-{{ epoch }} - paths: - - ~/.cache/hypothesis-build-runtimes - - ~/.cache/pip - - /usr/local/Homebrew diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/.flake8 new/hypothesis-hypothesis-python-3.82.5/.flake8 --- old/hypothesis-hypothesis-python-3.82.1/.flake8 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/.flake8 2018-12-08 15:00:43.000000000 +0100 @@ -7,7 +7,7 @@ test_imports.py, hypothesis-python/tests/py2/*, test_lambda_formatting.py -ignore = F811,D1,D205,D209,D213,D400,D401,D999,D202 +ignore = F811,D1,D205,D209,D213,D400,D401,D999,D202,W504 # Use flake8-alfred to forbid builtins that require compatibility wrappers. warn-symbols= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/.travis.yml new/hypothesis-hypothesis-python-3.82.5/.travis.yml --- old/hypothesis-hypothesis-python-3.82.1/.travis.yml 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/.travis.yml 2018-12-08 15:00:43.000000000 +0100 @@ -16,8 +16,6 @@ directories: - $HOME/.cargo - $HOME/.rustup - - $HOME/.runtimes - - $HOME/.venv - $HOME/.gem - $HOME/.cache/pip - $HOME/wheelhouse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/CONTRIBUTING.rst new/hypothesis-hypothesis-python-3.82.5/CONTRIBUTING.rst --- old/hypothesis-hypothesis-python-3.82.1/CONTRIBUTING.rst 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/CONTRIBUTING.rst 2018-12-08 15:00:43.000000000 +0100 @@ -213,6 +213,7 @@ * `Graham Williamson <https://github.com/00willo>`_ * `Grant David Bachman <https://github.com/grantbachman>`_ ([email protected]) * `Gregory Petrosyan <https://github.com/flyingmutant>`_ +* `Grigorios Giannakopoulos <https://github.com/grigoriosgiann>`_ * `Jack Massey <https://github.com/massey101>`_ * `Jakub Nabaglo <https://github.com/nbgl>`_ ([email protected]) * `Jeremy Thurgood <https://github.com/jerith>`_ @@ -220,6 +221,7 @@ * `JP Viljoen <https://github.com/froztbyte>`_ ([email protected]) * `Joey Tuong <https://github.com/tetrapus>`_ * `Jonty Wareing <https://www.github.com/Jonty>`_ ([email protected]) +* `jmhsi <https://www.github.com/jmhsi>`_ * `jwg4 <https://www.github.com/jwg4>`_ * `Karthikeyan Singaravelan <https://www.github.com/tirkarthi>`_ ([email protected]) * `kbara <https://www.github.com/kbara>`_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/changes.rst new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/changes.rst --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/changes.rst 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/changes.rst 2018-12-08 15:00:43.000000000 +0100 @@ -21,6 +21,54 @@ You should generally assume that an API is internal unless you have specific information to the contrary. +.. _v3.82.5: + +------------------- +3.82.5 - 2018-12-08 +------------------- + +This patch fixes :issue:`1667`, where passing bounds of Numpy +dtype ``int64`` to :func:`~hypothesis.strategies.integers` could +cause errors on Python 3 due to internal rounding. + +.. _v3.82.4: + +------------------- +3.82.4 - 2018-12-08 +------------------- + +Hypothesis now seeds and resets the global state of +:class:`np.random <numpy:numpy.random.RandomState>` for each +test case, to ensure that tests are reproducible. + +This matches and complements the existing handling of the +:mod:`python:random` module - Numpy simply maintains an +independent PRNG for performance reasons. + +.. _v3.82.3: + +------------------- +3.82.3 - 2018-12-08 +------------------- + +This is a no-op release to add the new ``Framework :: Hypothesis`` +`trove classifier <https://pypi.org/classifiers/>`_ to +:pypi:`hypothesis` on PyPI. + +You can `use it as a filter <https://pypi.org/search/?c=Framework+%3A%3A+Hypothesis>`_ +to find Hypothesis-related packages such as extensions as they add the tag +over the coming weeks, or simply visit :doc:`our curated list <strategies>`. + +.. _v3.82.2: + +------------------- +3.82.2 - 2018-12-08 +------------------- + +The :ref:`Hypothesis for Pandas extension <hypothesis-pandas>` is now +listed in ``setup.py``, so you can ``pip install hypothesis[pandas]``. +Thanks to jmshi for this contribution. + .. _v3.82.1: ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/examples.rst new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/examples.rst --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/examples.rst 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/examples.rst 2018-12-08 15:00:43.000000000 +0100 @@ -248,67 +248,23 @@ Wouldn't it be neat if we could use Hypothesis to provide an example of this? -Well as you can probably guess from the presence of this section, we can! This -is slightly surprising because it's not really obvious how we would generate an -election given the types that Hypothesis knows about. - -The trick here turns out to be twofold: - -1. We can generate a type that is *much larger* than an election, extract an election out of that, and rely on minimization to throw away all the extraneous detail. -2. We can use assume and rely on Hypothesis's adaptive exploration to focus on the examples that turn out to generate interesting elections - +Well as you can probably guess from the presence of this section, we can! +The main trick is to decide how we want to represent the result of an +election - for this example, we'll use a list of "votes", where each +vote is a list of candidates in the voters preferred order. Without further ado, here is the code: .. code:: python from hypothesis import given, assume - from hypothesis.strategies import integers, lists + from hypothesis.strategies import lists, permutations from collections import Counter - - def candidates(votes): - return {candidate for vote in votes for candidate in vote} - - - def build_election(votes): - """ - Given a list of lists we extract an election out of this. We do this - in two phases: - - 1. First of all we work out the full set of candidates present in all - votes and throw away any votes that do not have that whole set. - 2. We then take each vote and make it unique, keeping only the first - instance of any candidate. - - This gives us a list of total orderings of some set. It will usually - be a lot smaller than the starting list, but that's OK. - """ - all_candidates = candidates(votes) - votes = list(filter(lambda v: set(v) == all_candidates, votes)) - if not votes: - return [] - rebuilt_votes = [] - for vote in votes: - rv = [] - for v in vote: - if v not in rv: - rv.append(v) - assert len(rv) == len(all_candidates) - rebuilt_votes.append(rv) - return rebuilt_votes - - - @given(lists(lists(integers(min_value=1, max_value=5)))) + # We need at least three candidates and at least three voters to have a + # paradox; anything less can only lead to victories or at worst ties. + @given(lists(permutations(['A', 'B', 'C']), min_size=3)) def test_elections_are_transitive(election): - election = build_election(election) - # Small elections are unlikely to be interesting - assume(len(election) >= 3) - all_candidates = candidates(election) - # Elections with fewer than three candidates certainly can't exhibit - # intransitivity - assume(len(all_candidates) >= 3) - - # Now we check if the election is transitive + all_candidates = {"A", "B", "C"} # First calculate the pairwise counts of how many prefer each candidate # to the other @@ -321,7 +277,6 @@ # Now look at which pairs of candidates one has a majority over the # other and store that. graph = {} - all_candidates = candidates(election) for i in all_candidates: for j in all_candidates: if counts[(i, j)] > counts[(j, i)]: @@ -338,12 +293,11 @@ .. code:: python - [[3, 1, 4], [4, 3, 1], [1, 4, 3]] + [['A', 'B', 'C'], ['B', 'C', 'A'], ['C', 'A', 'B']] -Which does indeed do the job: The majority (votes 0 and 1) prefer 3 to 1, the -majority (votes 0 and 2) prefer 1 to 4 and the majority (votes 1 and 2) prefer -4 to 3. This is in fact basically the canonical example of the voting paradox, -modulo variations on the names of candidates. +Which does indeed do the job: The majority (votes 0 and 1) prefer B to C, the +majority (votes 0 and 2) prefer A to B and the majority (votes 1 and 2) prefer +C to A. This is in fact basically the canonical example of the voting paradox. ------------------- Fuzzing an HTTP API diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/quickstart.rst new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/quickstart.rst --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/quickstart.rst 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/quickstart.rst 2018-12-08 15:00:43.000000000 +0100 @@ -34,9 +34,8 @@ prev = character else: count += 1 - else: - entry = (character, count) - lst.append(entry) + entry = (character, count) + lst.append(entry) return lst @@ -144,9 +143,8 @@ prev = character else: count += 1 - else: - entry = (character, count) - lst.append(entry) + entry = (character, count) + lst.append(entry) return lst Hypothesis quickly informs us of the following example: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/strategies.rst new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/strategies.rst --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/docs/strategies.rst 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/docs/strategies.rst 2018-12-08 15:00:43.000000000 +0100 @@ -4,8 +4,9 @@ Hypothesis has been eagerly used and extended by the open source community. This page lists extensions and applications; you can find more or newer -packages by `searching PyPI <https://pypi.org/search/?q=hypothesis>`_ or -`libraries.io <https://libraries.io/search?languages=Python&q=hypothesis>`_. +packages by searching PyPI `by keyword <https://pypi.org/search/?q=hypothesis>`_ +or `filter by classifier <https://pypi.org/search/?c=Framework+%3A%3A+Hypothesis>`_, +or search `libraries.io <https://libraries.io/search?languages=Python&q=hypothesis>`_. If there's something missing which you think should be here, let us know! @@ -77,7 +78,8 @@ If you're thinking about writing an extension, please name it ``hypothesis-{something}`` - a standard prefix makes the community more -visible and searching for extensions easier. +visible and searching for extensions easier. And make sure you use the +``Framework :: Hypothesis`` trove classifier! On the other hand, being inside gets you access to some deeper implementation features (if you need them) and better long-term guarantees about maintenance. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/setup.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/setup.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/setup.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/setup.py 2018-12-08 15:00:43.000000000 +0100 @@ -58,6 +58,7 @@ 'dateutil': ['python-dateutil>=1.4'], 'fakefactory': ['Faker>=0.7'], 'numpy': ['numpy>=1.9.0'], + 'pandas': ['pandas>=0.19'], 'pytest': ['pytest>=3.0'], 'dpcontracts': ['dpcontracts>=0.4'], # We only support Django versions with upstream support - see @@ -100,6 +101,8 @@ python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', classifiers=[ 'Development Status :: 5 - Production/Stable', + 'Framework :: Hypothesis', + 'Framework :: Pytest', 'Intended Audience :: Developers', 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', 'Operating System :: Unix', @@ -115,7 +118,6 @@ 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Testing', - 'Framework :: Pytest', ], entry_points={ 'pytest11': ['hypothesispytest = hypothesis.extra.pytestplugin'], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/internal/compat.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/internal/compat.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/internal/compat.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/internal/compat.py 2018-12-08 15:00:43.000000000 +0100 @@ -81,6 +81,7 @@ hrange = range ARG_NAME_ATTRIBUTE = 'arg' integer_types = (int,) + _long_integer_type = int hunichr = chr def unicode_safe_repr(x): @@ -228,6 +229,7 @@ ARG_NAME_ATTRIBUTE = 'id' integer_types = (int, long) + _long_integer_type = long hunichr = unichr def escape_unicode_characters(s): @@ -516,22 +518,24 @@ FileExistsError = None -if PY2: - # Under Python 2, math.floor and math.ceil return floats, which cannot - # represent large integers - eg `float(2**53) == float(2**53 + 1)`. - # We therefore implement them entirely in (long) integer operations. - def floor(x): - if int(x) != x and x < 0: - return int(x) - 1 - return int(x) - - def ceil(x): - if int(x) != x and x > 0: - return int(x) + 1 - return int(x) -else: - floor = math.floor - ceil = math.ceil +# Under Python 2, math.floor and math.ceil return floats, which cannot +# represent large integers - eg `float(2**53) == float(2**53 + 1)`. +# We therefore implement them entirely in (long) integer operations. +# We use the same trick on Python 3, because Numpy values and other +# custom __floor__ or __ceil__ methods may convert via floats. +# See issue #1667, Numpy issue 9068. +def floor(x): + y = _long_integer_type(x) + if y != x and x < 0: + return y - 1 + return y + + +def ceil(x): + y = _long_integer_type(x) + if y != x and x > 0: + return y + 1 + return y try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/internal/entropy.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/internal/entropy.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/internal/entropy.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/internal/entropy.py 2018-12-08 15:00:43.000000000 +0100 @@ -20,6 +20,11 @@ import random import contextlib +try: + import numpy.random as npr +except ImportError: + npr = None + @contextlib.contextmanager def deterministic_PRNG(): @@ -32,7 +37,13 @@ """ _random_state = random.getstate() random.seed(0) + # These branches are covered by tests/numpy/, not tests/cover/ + if npr is not None: # pragma: no cover + _npr_state = npr.get_state() + npr.seed(0) try: yield finally: random.setstate(_random_state) + if npr is not None: # pragma: no cover + npr.set_state(_npr_state) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/searchstrategy/misc.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/searchstrategy/misc.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/searchstrategy/misc.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/searchstrategy/misc.py 2018-12-08 15:00:43.000000000 +0100 @@ -18,9 +18,7 @@ from __future__ import division, print_function, absolute_import import hypothesis.internal.conjecture.utils as d -from hypothesis.types import RandomWithSeed -from hypothesis.searchstrategy.strategies import SearchStrategy, \ - MappedSearchStrategy +from hypothesis.searchstrategy.strategies import SearchStrategy class BoolStrategy(SearchStrategy): @@ -65,17 +63,6 @@ return self.value -class RandomStrategy(MappedSearchStrategy): - """A strategy which produces Random objects. - - The conditional distribution is simply a RandomWithSeed seeded with - a 128 bits of data chosen uniformly at random. - """ - - def pack(self, i): - return RandomWithSeed(i) - - class SampledFromStrategy(SearchStrategy): """A strategy which samples from a set of elements. This is essentially equivalent to using a OneOfStrategy over Just strategies but may be more diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/strategies.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/strategies.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/strategies.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/strategies.py 2018-12-08 15:00:43.000000000 +0100 @@ -32,6 +32,7 @@ import attr +from hypothesis.types import RandomWithSeed from hypothesis.errors import InvalidArgument, ResolutionFailed from hypothesis.control import note, assume, reject, cleanup, \ current_build_context @@ -54,7 +55,7 @@ check_valid_integer, check_valid_interval, check_valid_magnitude from hypothesis.searchstrategy.lazy import LazyStrategy from hypothesis.searchstrategy.misc import BoolStrategy, JustStrategy, \ - RandomStrategy, SampledFromStrategy + SampledFromStrategy from hypothesis.searchstrategy.shared import SharedStrategy from hypothesis.searchstrategy.numbers import FloatStrategy, \ BoundedIntStrategy, IntegersFromStrategy, WideRangeIntStrategy, \ @@ -87,7 +88,6 @@ if False: from types import ModuleType # noqa - from random import Random # noqa from typing import Any, Dict, Union, Sequence, Callable, Pattern # noqa from typing import TypeVar, Tuple, List, Set, FrozenSet, overload # noqa from typing import Type, Text, AnyStr, Optional # noqa @@ -290,7 +290,7 @@ strategies. This may be called with one iterable argument instead of multiple - strategy arguments. In which case ``one_of(x)`` and ``one_of(*x)`` are + strategy arguments, in which case ``one_of(x)`` and ``one_of(*x)`` are equivalent. Examples from this strategy will generally shrink to ones that come from @@ -335,15 +335,15 @@ if min_value != min_int_value: note_deprecation( - 'min_value=%r cannot be exactly represented as an integer, which ' - 'will be an error in a future version.' - % (min_value) + 'min_value=%r of type %r cannot be exactly represented as an ' + 'integer, which will be an error in a future version. ' + 'Use %r instead.' % (min_value, type(min_value), min_int_value) ) if max_value != max_int_value: note_deprecation( - 'max_value=%r cannot be exactly represented as an integer, which ' - 'will be an error in a future version.' - % (max_value) + 'max_value=%r of type %r cannot be exactly represented as an ' + 'integer, which will be an error in a future version. ' + 'Use %r instead.' % (max_value, type(max_value), max_int_value) ) if min_int_value is not None and max_int_value is not None and \ @@ -380,7 +380,7 @@ @defines_strategy def booleans(): # type: () -> SearchStrategy[bool] - """Returns a strategy which generates instances of bool. + """Returns a strategy which generates instances of :class:`python:bool`. Examples from this strategy will shrink towards False (i.e. shrinking will try to replace True with False where possible). @@ -415,7 +415,7 @@ Passing ``width=32`` will still use the builtin 64-bit ``float`` class, but always for values which can be exactly represented as a 32-bit float. Half-precision floats (``width=16``) are only supported on Python 3.6, or - if Numpy is installed. + if :pypi:`Numpy` is installed. Examples from this strategy have a complicated and hard to explain shrinking behaviour, but it tries to improve "human readability". Finite @@ -1104,13 +1104,13 @@ @cacheable @defines_strategy def randoms(): - # type: () -> SearchStrategy[Random] - """Generates instances of Random (actually a Hypothesis specific - RandomWithSeed class which displays what it was initially seeded with) + # type: () -> SearchStrategy[random.Random] + """Generates instances of ``random.Random``, tweaked to show the seed value + in the repr for reproducibility. Examples from this strategy shrink to seeds closer to zero. """ - return RandomStrategy(integers()) + return integers().map(RandomWithSeed) class RandomSeeder(object): @@ -1125,25 +1125,30 @@ class RandomModule(SearchStrategy): def do_draw(self, data): data.can_reproduce_example_from_repr = False - seed = data.draw(integers()) + seed = data.draw(integers(0, 2 ** 32 - 1)) state = random.getstate() random.seed(seed) cleanup(lambda: random.setstate(state)) + if numpy is not None: # pragma: no cover + npstate = numpy.random.get_state() + numpy.random.seed(seed) + cleanup(lambda: numpy.random.set_state(npstate)) return RandomSeeder(seed) @cacheable @defines_strategy def random_module(): - """If your code depends on the global random module then you need to use - this. - - It will explicitly seed the random module at the start of your test - so that tests are reproducible. The value it passes you is an opaque - object whose only useful feature is that its repr displays the - random seed. It is not itself a random number generator. If you want - a random number generator you should use the randoms() strategy - which will give you one. + """The Hypothesis engine handles PRNG state for the stdlib and Numpy random + modules internally, always seeding them to zero and restoring the previous + state after the test. + + If having a fixed seed would unacceptably weaken your tests, and you + cannot use a ``random.Random`` instance provided by + `:func:`~hypothesis.strategies.randoms`, this strategy calls + :func:`python:random.seed` with an arbitrary integer and passes you + an opaque object whose repr displays the seed value for debugging. + If ``numpy.random`` is available, that state is also managed. Examples from these strategy shrink to seeds closer to zero. """ @@ -1699,7 +1704,7 @@ # that took aware bounds, but the API and validation is much harder. # If you want to generate datetimes between two particular momements in # time I suggest (a) just filtering out-of-bounds values; (b) if bounds - # are very close, draw a value and subtract it's UTC offset, handling + # are very close, draw a value and subtract its UTC offset, handling # overflows and nonexistent times; or (c) do something customised to # handle datetimes in e.g. a four-microsecond span which is not # representable in UTC. Handling (d), all of the above, leads to a much diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/version.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/version.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/src/hypothesis/version.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/src/hypothesis/version.py 2018-12-08 15:00:43.000000000 +0100 @@ -17,5 +17,5 @@ from __future__ import division, print_function, absolute_import -__version_info__ = (3, 82, 1) +__version_info__ = (3, 82, 5) __version__ = '.'.join(map(str, __version_info__)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/common/setup.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/common/setup.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/common/setup.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/common/setup.py 2018-12-08 15:00:43.000000000 +0100 @@ -40,6 +40,16 @@ filterwarnings('ignore', message='numpy.dtype size changed') filterwarnings('ignore', message='numpy.ufunc size changed') + # See https://github.com/HypothesisWorks/hypothesis/issues/1674 + filterwarnings( + 'ignore', + message=( + 'The virtualenv distutils package at .+ appears to be in the ' + 'same location as the system distutils?' + ), + category=UserWarning + ) + # Imported by Pandas in version 1.9, but fixed in later versions. filterwarnings( 'ignore', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/django/toystore/test_given_models.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/django/toystore/test_given_models.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/django/toystore/test_given_models.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/django/toystore/test_given_models.py 2018-12-08 15:00:43.000000000 +0100 @@ -151,7 +151,7 @@ ) try: ConjectureData.for_buffer(buf).draw(strategy) - except HypothesisException as e: + except HypothesisException: reject() # Draw again with the same buffer. This will cause a duplicate # primary key. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/numpy/test_narrow_floats.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/numpy/test_narrow_floats.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/numpy/test_narrow_floats.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/numpy/test_narrow_floats.py 2018-12-08 15:00:43.000000000 +0100 @@ -20,7 +20,8 @@ import numpy as np from hypothesis import given -from hypothesis.strategies import floats +from hypothesis.strategies import data, floats, integers +from hypothesis.extra.numpy import from_dtype, integer_dtypes @given(floats(width=32)) @@ -39,3 +40,11 @@ assert np.isnan(clipped) else: assert x == float(clipped) + + +@given(data=data(), dtype=integer_dtypes()) +def test_floor_ceil_lossless(data, dtype): + # Regression test for issue #1667; ceil converting numpy integers + # to float and back to int with loss of exact value. + x = data.draw(from_dtype(dtype)) + assert data.draw(integers(x, x)) == x diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/numpy/test_randomness.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/numpy/test_randomness.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/numpy/test_randomness.py 1970-01-01 01:00:00.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/numpy/test_randomness.py 2018-12-08 15:00:43.000000000 +0100 @@ -0,0 +1,41 @@ +# coding=utf-8 +# +# This file is part of Hypothesis, which may be found at +# https://github.com/HypothesisWorks/hypothesis-python +# +# Most of this work is copyright (C) 2013-2018 David R. MacIver +# ([email protected]), but it contains contributions by others. See +# CONTRIBUTING.rst for a full list of people who may hold copyright, and +# consult the git log if you need to determine who owns an individual +# contribution. +# +# This Source Code Form is subject to the terms of the Mozilla Public License, +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at http://mozilla.org/MPL/2.0/. +# +# END HEADER + +from __future__ import division, print_function, absolute_import + +import numpy as np + +from hypothesis import given +from hypothesis.strategies import none + + +def test_numpy_prng_is_seeded(): + first = [] + prng_state = np.random.get_state() + + @given(none()) + def inner(_): + val = np.random.bytes(10) + if not first: + first.append(val) + assert val == first[0], 'Numpy random module should be reproducible' + + inner() + + np.testing.assert_array_equal( + np.random.get_state()[1], prng_state[1], 'State was not restored.' + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/py3/test_lookup.py new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/py3/test_lookup.py --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tests/py3/test_lookup.py 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tests/py3/test_lookup.py 2018-12-08 15:00:43.000000000 +0100 @@ -249,7 +249,7 @@ assert isinstance(v1, expected) -def annotated_func(a: int, b: int=2, *, c: int, d: int=4): +def annotated_func(a: int, b: int = 2, *, c: int, d: int = 4): return a + b + c + d diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tox.ini new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tox.ini --- old/hypothesis-hypothesis-python-3.82.1/hypothesis-python/tox.ini 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/hypothesis-python/tox.ini 2018-12-08 15:00:43.000000000 +0100 @@ -111,14 +111,12 @@ python -m tests.django.manage test tests.django [testenv:django20] -basepython=python3 commands = pip install .[pytz] pip install django~=2.0.1 python -m tests.django.manage test tests.django [testenv:django21] -basepython=python3 commands = pip install .[pytz] pip install django~=2.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/requirements/coverage.txt new/hypothesis-hypothesis-python-3.82.5/requirements/coverage.txt --- old/hypothesis-hypothesis-python-3.82.1/requirements/coverage.txt 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/requirements/coverage.txt 2018-12-08 15:00:43.000000000 +0100 @@ -4,9 +4,9 @@ # # pip-compile --output-file requirements/coverage.txt requirements/coverage.in # -coverage==4.5.1 -numpy==1.15.2 +coverage==4.5.2 +numpy==1.15.4 pandas==0.23.4 -python-dateutil==2.7.3 # via pandas -pytz==2018.5 +python-dateutil==2.7.5 # via pandas +pytz==2018.7 six==1.11.0 # via python-dateutil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/requirements/test.txt new/hypothesis-hypothesis-python-3.82.5/requirements/test.txt --- old/hypothesis-hypothesis-python-3.82.1/requirements/test.txt 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/requirements/test.txt 2018-12-08 15:00:43.000000000 +0100 @@ -11,10 +11,10 @@ flaky==3.4.0 mock==2.0.0 more-itertools==4.3.0 # via pytest -pbr==4.3.0 # via mock -pluggy==0.7.1 # via pytest +pbr==5.1.1 # via mock +pluggy==0.8.0 # via pytest py==1.7.0 # via pytest pytest-forked==0.2 # via pytest-xdist -pytest-xdist==1.23.2 -pytest==3.8.2 +pytest-xdist==1.24.1 +pytest==4.0.1 six==1.11.0 # via mock, more-itertools, pytest, pytest-xdist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/requirements/tools.txt new/hypothesis-hypothesis-python-3.82.5/requirements/tools.txt --- old/hypothesis-hypothesis-python-3.82.1/requirements/tools.txt 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/requirements/tools.txt 2018-12-08 15:00:43.000000000 +0100 @@ -8,96 +8,91 @@ atomicwrites==1.2.1 # via pytest attrs==18.2.0 autoflake==1.2 # via pyformat -autopep8==1.4 # via pyformat +autopep8==1.4.3 # via pyformat babel==2.6.0 # via sphinx backcall==0.1.0 # via ipython bandit==1.5.1 bleach==3.0.2 # via readme-renderer -certifi==2018.10.15 # via requests -cffi==1.11.5 # via cmarkgfm +certifi==2018.11.29 # via requests chardet==3.0.4 # via requests click==7.0 # via pip-tools, pyupio, safety -cmarkgfm==0.4.2 # via readme-renderer -coverage==4.5.1 +coverage==4.5.2 decorator==4.3.0 # via ipython, traitlets -deprecated==1.2.3 # via pygithub -django==2.1.2 +deprecated==1.2.4 # via pygithub +django==2.1.3 docformatter==1.0 # via pyformat docutils==0.14 # via readme-renderer, restructuredtext-lint, sphinx dparse==0.4.1 # via pyupio, safety dpcontracts==0.6.0 -filelock==3.0.9 # via tox +filelock==3.0.10 # via tox flake8-alfred==1.1.1 flake8-docstrings==1.3.0 flake8-polyfill==1.0.2 # via flake8-docstrings -flake8==3.5.0 +flake8==3.6.0 flaky==3.4.0 -future==0.16.0 # via readme-renderer gitdb2==2.0.5 # via gitpython gitpython==2.1.11 # via bandit idna==2.7 # via requests imagesize==1.1.0 # via sphinx ipython-genutils==0.2.0 # via traitlets -ipython==7.0.1 +ipython==7.2.0 isort==4.3.4 jedi==0.13.1 # via ipython jinja2==2.10 # via pyupio, sphinx -markupsafe==1.0 # via jinja2 +markupsafe==1.1.0 # via jinja2 mccabe==0.6.1 # via flake8 mock==2.0.0 more-itertools==4.3.0 # via pytest mypy-extensions==0.4.1 # via mypy mypy==0.641 -numpy==1.15.2 +numpy==1.15.4 packaging==18.0 # via dparse, pyupio, safety, sphinx parso==0.3.1 # via jedi -pbr==4.3.0 # via mock, stevedore +pbr==5.1.1 # via mock, stevedore pexpect==4.6.0 # via ipython pickleshare==0.7.5 # via ipython pip-tools==3.1.0 pkginfo==1.4.2 # via twine -pluggy==0.7.1 # via pytest, tox -prompt-toolkit==2.0.6 # via ipython +pluggy==0.8.0 # via pytest, tox +prompt-toolkit==2.0.7 # via ipython ptyprocess==0.6.0 # via pexpect py==1.7.0 # via pytest, tox -pycodestyle==2.3.1 # via autopep8, flake8 -pycparser==2.19 # via cffi +pycodestyle==2.4.0 # via autopep8, flake8 pydocstyle==3.0.0 # via flake8-docstrings -pyflakes==1.6.0 # via autoflake, flake8 +pyflakes==2.0.0 # via autoflake, flake8 pyformat==0.7 -pygithub==1.43.2 # via pyupio -pygments==2.2.0 # via ipython, readme-renderer, sphinx -pyjwt==1.6.4 # via pygithub -pyparsing==2.2.2 # via packaging -pytest==3.8.2 -python-dateutil==2.7.3 +pygithub==1.43.3 # via pyupio +pygments==2.3.0 # via ipython, readme-renderer, sphinx +pyjwt==1.7.0 # via pygithub +pyparsing==2.3.0 # via packaging +pytest==4.0.1 +python-dateutil==2.7.5 python-gitlab==1.6.0 # via pyupio -pytz==2018.5 # via babel, django +pytz==2018.7 # via babel, django pyupio==1.0.2 pyyaml==3.13 # via bandit, dparse, pyupio -readme-renderer==22.0 # via twine +readme-renderer==24.0 # via twine requests-toolbelt==0.8.0 # via twine -requests==2.19.1 -restructuredtext-lint==1.1.3 +requests==2.20.1 +restructuredtext-lint==1.2.1 safety==1.8.4 # via pyupio -simplegeneric==0.8.1 # via ipython six==1.11.0 # via bandit, bleach, dparse, mock, more-itertools, packaging, pip-tools, prompt-toolkit, pydocstyle, pytest, python-dateutil, python-gitlab, pyupio, readme-renderer, sphinx, stevedore, tox, traitlets smmap2==2.0.5 # via gitdb2 snowballstemmer==1.2.1 # via pydocstyle, sphinx sphinx-rtd-theme==0.4.2 -sphinx==1.8.1 +sphinx==1.8.2 sphinxcontrib-websupport==1.1.0 # via sphinx -stevedore==1.29.0 # via bandit +stevedore==1.30.0 # via bandit toml==0.10.0 -tox==3.5.2 -tqdm==4.27.0 # via pyupio, twine +tox==3.5.3 +tqdm==4.28.1 # via pyupio, twine traitlets==4.3.2 # via ipython twine==1.12.1 typed-ast==1.1.0 # via mypy unify==0.4 # via pyformat untokenize==0.1.1 # via docformatter, unify -urllib3==1.23 # via requests -virtualenv==16.0.0 # via tox +urllib3==1.24.1 # via requests +virtualenv==16.1.0 # via tox wcwidth==0.1.7 # via prompt-toolkit webencodings==0.5.1 # via bleach wrapt==1.10.11 # via deprecated diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.82.1/tooling/scripts/install-python.sh new/hypothesis-hypothesis-python-3.82.5/tooling/scripts/install-python.sh --- old/hypothesis-hypothesis-python-3.82.1/tooling/scripts/install-python.sh 2018-10-30 00:40:11.000000000 +0100 +++ new/hypothesis-hypothesis-python-3.82.5/tooling/scripts/install-python.sh 2018-12-08 15:00:43.000000000 +0100 @@ -86,22 +86,22 @@ for var in "$@"; do case "${var}" in 2.7) - install 2.7.14 python2.7 + install 2.7.15 python2.7 ;; 2.7.3) install 2.7.3 python2.7.3 ;; 3.4) - install 3.4.3 python3.4 + install 3.4.9 python3.4 ;; 3.5) - install 3.5.1 python3.5 + install 3.5.6 python3.5 ;; 3.6) - install 3.6.1 python3.6 + install 3.6.7 python3.6 ;; 3.7) - install 3.7.0 python3.7 + install 3.7.1 python3.7 ;; pypy) install pypy2.7-5.8.0 pypy
