Hello community,

here is the log from the commit of package python-hypothesis for 
openSUSE:Factory checked in at 2019-05-17 23:37:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-hypothesis (Old)
 and      /work/SRC/openSUSE:Factory/.python-hypothesis.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-hypothesis"

Fri May 17 23:37:18 2019 rev:36 rq:702824 version:4.23.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-hypothesis/python-hypothesis.changes      
2019-05-07 23:13:03.828174220 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-hypothesis.new.5148/python-hypothesis.changes
    2019-05-17 23:37:19.726104138 +0200
@@ -1,0 +2,8 @@
+Tue May 14 11:05:16 UTC 2019 - Ondřej Súkup <[email protected]>
+
+- update to 4.23.4
+  * Adds a recipe to the docstring of :func:`~hypothesis.strategies.from_type`
+  * implements the :func:`~hypothesis.strategies.slices` strategy,
+     to generate slices of a length-size sequence.
+
+-------------------------------------------------------------------

Old:
----
  hypothesis-python-4.22.0.tar.gz

New:
----
  hypothesis-python-4.23.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-hypothesis.spec ++++++
--- /var/tmp/diff_new_pack.ljNv9B/_old  2019-05-17 23:37:20.362103804 +0200
+++ /var/tmp/diff_new_pack.ljNv9B/_new  2019-05-17 23:37:20.366103801 +0200
@@ -28,7 +28,7 @@
 %endif
 %bcond_without python2
 Name:           python-hypothesis%{psuffix}
-Version:        4.22.0
+Version:        4.23.4
 Release:        0
 Summary:        A library for property based testing
 License:        MPL-2.0

++++++ hypothesis-python-4.22.0.tar.gz -> hypothesis-python-4.23.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hypothesis-hypothesis-python-4.22.0/CONTRIBUTING.rst 
new/hypothesis-hypothesis-python-4.23.4/CONTRIBUTING.rst
--- old/hypothesis-hypothesis-python-4.22.0/CONTRIBUTING.rst    2019-05-07 
05:30:36.000000000 +0200
+++ new/hypothesis-hypothesis-python-4.23.4/CONTRIBUTING.rst    2019-05-09 
08:15:59.000000000 +0200
@@ -202,6 +202,7 @@
 * `Cory Benfield <https://www.github.com/Lukasa>`_
 * `Cristi Cobzarenco <https://github.com/cristicbz>`_ ([email protected])
 * `Damon Francisco <https://github.com/dtfrancisco>`_ 
([email protected])
+* `Daniel J. West <https://github.com/danieljwest>`_
 * `David Bonner <https://github.com/rascalking>`_ ([email protected])
 * `David Chudzicki <https://github.com/dchudz>`_ ([email protected])
 * `Derek Gustafson <https://www.github.com/degustaf>`_
@@ -273,3 +274,4 @@
 * `Will Thompson <https://www.github.com/wjt>`_ ([email protected])
 * `Wilfred Hughes <https://www.github.com/wilfred>`_
 * `Zac Hatfield-Dodds <https://www.github.com/Zac-HD>`_ 
([email protected])
+* `Zebulun Arendsee <https://www.github.com/arendsee>`_ ([email protected])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/docs/changes.rst 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/docs/changes.rst
--- old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/docs/changes.rst  
2019-05-07 05:30:36.000000000 +0200
+++ new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/docs/changes.rst  
2019-05-09 08:15:59.000000000 +0200
@@ -21,6 +21,89 @@
 You should generally assume that an API is internal unless you have specific
 information to the contrary.
 
+.. _v4.23.4:
+
+-------------------
+4.23.4 - 2019-05-09
+-------------------
+
+Fixes a minor formatting issue the docstring of 
:func:`~hypothesis.strategies.from_type`
+
+.. _v4.23.3:
+
+-------------------
+4.23.3 - 2019-05-09
+-------------------
+
+Adds a recipe to the docstring of :func:`~hypothesis.strategies.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.
+
+.. _v4.23.2:
+
+-------------------
+4.23.2 - 2019-05-08
+-------------------
+
+This patch uses :pypi:`autoflake` to remove some pointless ``pass`` statements,
+which improves our workflow but has no user-visible impact.
+
+.. _v4.23.1:
+
+-------------------
+4.23.1 - 2019-05-08
+-------------------
+
+This patch fixes an OverflowError in
+:func:`from_type(xrange) <hypothesis.strategies.from_type>` 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.
+
+.. _v4.23.0:
+
+-------------------
+4.23.0 - 2019-05-08
+-------------------
+
+This release implements the :func:`~hypothesis.strategies.slices` strategy,
+to generate slices of a length-``size`` sequence.
+
+Thanks to Daniel J. West for writing this patch at the PyCon 2019 sprints!
+
+.. _v4.22.3:
+
+-------------------
+4.22.3 - 2019-05-07
+-------------------
+
+This patch exposes :class:`~hypothesis.strategies.DataObject`, *solely*
+to support more precise type hints.  Objects of this type are provided
+by :func:`~hypothesis.strategies.data`, and can be used to draw examples
+from strategies intermixed with your test code.
+
+.. _v4.22.2:
+
+-------------------
+4.22.2 - 2019-05-07
+-------------------
+
+This patch fixes the very rare :issue:`1798` in
+:func:`~hypothesis.extra.numpy.array_dtypes`,
+which caused an internal error in our tests.
+
+.. _v4.22.1:
+
+-------------------
+4.22.1 - 2019-05-07
+-------------------
+
+This patch fixes a rare bug in :func:`from_type(range) 
<hypothesis.strategies.from_type>`.
+
+Thanks to Zebulun Arendsee for fixing the bug at the PyCon 2019 Sprints.
+
 .. _v4.22.0:
 
 -------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/_strategies.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/_strategies.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/_strategies.py
     2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/_strategies.py
     2019-05-09 08:15:59.000000000 +0200
@@ -1305,6 +1305,25 @@
        other elements in the lookup.
     4. Finally, if ``thing`` has type annotations for all required arguments,
        it is resolved via :func:`~hypothesis.strategies.builds`.
+
+    There is a valuable recipe for leveraging ``from_type()`` to generate
+    "everything except" values from a specified type. I.e.
+
+    .. code-block:: python
+
+        def everything_except(excluded_types):
+            return (
+                from_type(type).flatmap(from_type)
+                .filter(lambda x: not isinstance(x, excluded_types))
+            )
+
+    For example, ``everything_except(int)`` returns a strategy that can
+    generate anything that ``from_type()`` can ever generate, except for
+    instances of :class:python:int, and excluding instances of types
+    added via :func:~hypothesis.strategies.register_type_strategy.
+
+    This is useful when writing tests which check that invalid input is
+    rejected in a certain way.
     """
     # TODO: We would like to move this to the top level, but pending some major
     # refactoring it's hard to do without creating circular imports.
@@ -2052,6 +2071,13 @@
 
 
 class DataObject(object):
+    """This type only exists so that you can write type hints for tests using
+    the :func:`~hypothesis.strategies.data` strategy.  Do not use it directly!
+    """
+
+    # Note that "only exists" here really means "is only exported to users",
+    # but we want to treat it as "semi-stable", not document it as "public 
API".
+
     def __init__(self, data):
         self.count = 0
         self.conjecture_data = data
@@ -2060,6 +2086,7 @@
         return "data(...)"
 
     def draw(self, strategy, label=None):
+        # type: (SearchStrategy[Ex], Any) -> Ex
         result = self.conjecture_data.draw(strategy)
         self.count += 1
         if label is not None:
@@ -2103,7 +2130,7 @@
 
 @cacheable
 def data():
-    # type: () -> SearchStrategy[Any]
+    # type: () -> SearchStrategy[DataObject]
     """This isn't really a normal strategy, but instead gives you an object
     which can be used to draw data interactively from other strategies.
 
@@ -2238,3 +2265,42 @@
             "but got non-callable like=%r" % (nicerepr(like),)
         )
     return FunctionStrategy(like, returns)
+
+
+@composite
+def slices(draw, size):
+    """Generates slices that will select indices up to the supplied size
+
+    Generated slices will have start and stop indices that range from 0 to 
size - 1
+    and will step in the appropriate direction. Slices should only produce an 
empty selection
+    if the start and end are the same.
+
+    Examples from this strategy shrink toward 0 and smaller values
+    """
+    check_valid_integer(size)
+    if size is None or size < 1:
+        raise InvalidArgument("size=%r must be at least one" % size)
+
+    min_start = min_stop = 0
+    max_start = max_stop = size
+    min_step = 1
+    # For slices start is inclusive and stop is exclusive
+    start = draw(integers(min_start, max_start) | none())
+    stop = draw(integers(min_stop, max_stop) | none())
+
+    # Limit step size to be reasonable
+    if start is None and stop is None:
+        max_step = size
+    elif start is None:
+        max_step = stop
+    elif stop is None:
+        max_step = start
+    else:
+        max_step = abs(start - stop)
+
+    step = draw(integers(min_step, max_step or 1))
+
+    if (stop or 0) < (start or 0):
+        step *= -1
+
+    return slice(start, stop, step)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/extra/numpy.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/extra/numpy.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/extra/numpy.py
     2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/extra/numpy.py
     2019-05-09 08:15:59.000000000 +0200
@@ -26,7 +26,7 @@
 from hypothesis import Verbosity
 from hypothesis._settings import note_deprecation
 from hypothesis.errors import InvalidArgument
-from hypothesis.internal.compat import hrange, integer_types, text_type
+from hypothesis.internal.compat import hrange, integer_types
 from hypothesis.internal.coverage import check_function
 from hypothesis.internal.reflection import proxies
 from hypothesis.internal.validation import check_type, check_valid_interval
@@ -636,9 +636,7 @@
     """Return a strategy for generating array (compound) dtypes, with members
     drawn from the given subtype strategy."""
     order_check("size", 0, min_size, max_size)
-    native_strings = st.text()  # type: SearchStrategy[Any]
-    if text_type is not str:  # pragma: no cover
-        native_strings = st.binary()
+    native_strings = st.from_type(str).filter(bool)  # See issue #1798 re: 
filter!
     elements = st.tuples(native_strings, subtype_strategy)
     if allow_subarrays:
         elements |= st.tuples(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/internal/cache.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/internal/cache.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/internal/cache.py
  2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/internal/cache.py
  2019-05-09 08:15:59.000000000 +0200
@@ -184,7 +184,6 @@
     def on_evict(self, key, value, score):
         """Called after a key has been evicted, with the score it had had at
         the point of eviction."""
-        pass
 
     def check_valid(self):
         """Debugging method for use in tests.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/internal/conjecture/data.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/internal/conjecture/data.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/internal/conjecture/data.py
        2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/internal/conjecture/data.py
        2019-05-09 08:15:59.000000000 +0200
@@ -235,18 +235,15 @@
         """Called at the start of each example, with ``i`` the
         index of the example and ``label_index`` the index of
         its label in ``self.examples.labels``."""
-        pass
 
     def block(self, i):
         """Called with each ``draw_bits`` call, with ``i`` the index of the
         corresonding block in ``self.examples.blocks``"""
-        pass
 
     def stop_example(self, i, discarded):
         """Called at the end of each example, with ``i`` the
         index of the example and ``discarded`` being ``True`` if 
``stop_example``
         was called with ``discard=True``."""
-        pass
 
     def finish(self):
         return self.result
@@ -677,7 +674,6 @@
 
         Note that this is called after ``freeze`` has completed.
         """
-        pass
 
     def draw_bits(self, n_bits, forced, value):
         """Called when ``draw_bits`` is called on on the
@@ -687,7 +683,6 @@
            draw was forced or ``False`` otherwise.
         * ``value`` is the result that ``draw_bits`` returned.
         """
-        pass
 
 
 @attr.s(slots=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/common.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/common.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/common.py
    2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/internal/conjecture/shrinking/common.py
    2019-05-09 08:15:59.000000000 +0200
@@ -98,7 +98,6 @@
         Convenience function for children that doesn't require messing
         with the signature of init.
         """
-        pass
 
     def delegate(self, other_class, convert_to, convert_from, **kwargs):
         """Delegates shrinking to another shrinker class, by converting the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/searchstrategy/types.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/searchstrategy/types.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/searchstrategy/types.py
    2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/searchstrategy/types.py
    2019-05-09 08:15:59.000000000 +0200
@@ -25,6 +25,7 @@
 import inspect
 import io
 import numbers
+import sys
 import uuid
 
 import hypothesis.strategies as st
@@ -198,13 +199,17 @@
 }
 
 if PY2:
+    # xrange's |stop - start| must fit in a C long
+    int64_strat = st.integers(-sys.maxint // 2, sys.maxint // 2)  # noqa
     _global_type_lookup.update(
         {
             int: st.integers().filter(lambda x: isinstance(x, int)),
             long: st.integers().map(long),  # noqa
-            xrange: st.integers(min_value=0).map(xrange)  # noqa
-            | st.builds(xrange, st.integers(), st.integers())  # noqa
-            | st.builds(xrange, st.integers(), st.integers(), st.integers()),  
# noqa
+            xrange: st.integers(min_value=0, max_value=sys.maxint).map(xrange) 
 # noqa
+            | st.builds(xrange, int64_strat, int64_strat)  # noqa
+            | st.builds(
+                xrange, int64_strat, int64_strat, int64_strat.filter(bool)  # 
noqa
+            ),
         }
     )
 else:
@@ -212,7 +217,7 @@
         {
             range: st.integers(min_value=0).map(range)
             | st.builds(range, st.integers(), st.integers())
-            | st.builds(range, st.integers(), st.integers(), st.integers())
+            | st.builds(range, st.integers(), st.integers(), 
st.integers().filter(bool))
         }
     )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/stateful.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/stateful.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/stateful.py
        2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/stateful.py
        2019-05-09 08:15:59.000000000 +0200
@@ -206,11 +206,9 @@
 
         Does nothing by default.
         """
-        pass
 
     def check_invariants(self):
         """Called after initializing and after executing each step."""
-        pass
 
     _test_case_cache = {}  # type: dict
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/strategies.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/strategies.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/strategies.py
      2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/strategies.py
      2019-05-09 08:15:59.000000000 +0200
@@ -18,6 +18,7 @@
 from __future__ import absolute_import, division, print_function
 
 from hypothesis._strategies import (
+    DataObject,
     _strategies,
     binary,
     booleans,
@@ -55,6 +56,7 @@
     sampled_from,
     sets,
     shared,
+    slices,
     text,
     timedeltas,
     times,
@@ -76,6 +78,7 @@
     "complex_numbers",
     "composite",
     "data",
+    "DataObject",
     "dates",
     "datetimes",
     "decimals",
@@ -105,6 +108,7 @@
     "sampled_from",
     "sets",
     "shared",
+    "slices",
     "text",
     "timedeltas",
     "times",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/version.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/version.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/src/hypothesis/version.py
 2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/src/hypothesis/version.py
 2019-05-09 08:15:59.000000000 +0200
@@ -17,5 +17,5 @@
 
 from __future__ import absolute_import, division, print_function
 
-__version_info__ = (4, 22, 0)
+__version_info__ = (4, 23, 4)
 __version__ = ".".join(map(str, __version_info__))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_deadline.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_deadline.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_deadline.py
      2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_deadline.py
      2019-05-09 08:15:59.000000000 +0200
@@ -70,15 +70,15 @@
 
 def test_deadlines_participate_in_shrinking():
     @settings(deadline=500)
-    @given(st.integers())
+    @given(st.integers(min_value=0))
     def slow_if_large(i):
-        if i >= 10000:
+        if i >= 1000:
             time.sleep(1)
 
     with capture_out() as o:
         with pytest.raises(DeadlineExceeded):
             slow_if_large()
-    assert "slow_if_large(i=10000)" in o.getvalue()
+    assert "slow_if_large(i=1000)" in o.getvalue()
 
 
 def test_keeps_you_well_above_the_deadline():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_direct_strategies.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_direct_strategies.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_direct_strategies.py
     2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_direct_strategies.py
     2019-05-09 08:15:59.000000000 +0200
@@ -161,6 +161,11 @@
     (ds.characters, {"max_codepoint": "1"}),
     (ds.characters, {"whitelist_categories": []}),
     (ds.characters, {"whitelist_categories": ["Nd"], "blacklist_categories": 
["Nd"]}),
+    (ds.slices, {"size": 0}),
+    (ds.slices, {"size": None}),
+    (ds.slices, {"size": "chips"}),
+    (ds.slices, {"size": -1}),
+    (ds.slices, {"size": 2.3}),
 )
 def test_validates_keyword_arguments(fn, kwargs):
     with pytest.raises(InvalidArgument):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_float_utils.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_float_utils.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_float_utils.py
   2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_float_utils.py
   2019-05-09 08:15:59.000000000 +0200
@@ -17,8 +17,30 @@
 
 from __future__ import absolute_import, division, print_function
 
-from hypothesis.internal.floats import count_between_floats
+import math
+
+import pytest
+
+from hypothesis.internal.floats import count_between_floats, next_down, next_up
 
 
 def test_can_handle_straddling_zero():
     assert count_between_floats(-0.0, 0.0) == 2
+
+
[email protected](
+    "func,val",
+    [
+        (next_up, float("nan")),
+        (next_up, float("inf")),
+        (next_up, -0.0),
+        (next_down, float("nan")),
+        (next_down, float("-inf")),
+        (next_down, 0.0),
+    ],
+)
+def test_next_float_equal(func, val):
+    if math.isnan(val):
+        assert math.isnan(func(val))
+    else:
+        assert func(val) == val
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_slices.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_slices.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_slices.py
        1970-01-01 01:00:00.000000000 +0100
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_slices.py
        2019-05-09 08:15:59.000000000 +0200
@@ -0,0 +1,104 @@
+# coding=utf-8
+#
+# This file is part of Hypothesis, which may be found at
+# https://github.com/HypothesisWorks/hypothesis/
+#
+# Most of this work is copyright (C) 2013-2019 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 https://mozilla.org/MPL/2.0/.
+#
+# END HEADER
+
+from __future__ import absolute_import, division, print_function
+
+import pytest
+
+from hypothesis import given, settings, strategies as st
+from tests.common.debug import assert_all_examples, find_any, minimal
+
+use_several_sizes = pytest.mark.parametrize("size", [1, 2, 5, 10, 100, 1000])
+
+
+@use_several_sizes
+def test_stop_stays_within_bounds(size):
+    assert_all_examples(
+        st.slices(size), lambda x: x.stop is None or (x.stop >= 0 and x.stop 
<= size)
+    )
+
+
+@use_several_sizes
+def test_start_stay_within_bounds(size):
+    assert_all_examples(
+        st.slices(size), lambda x: x.start is None or (x.start >= 0 and 
x.start <= size)
+    )
+
+
+@use_several_sizes
+def test_step_stays_within_bounds(size):
+    # indices -> (start, stop, step)
+    # Stop is exclusive so we use -1 as the floor.
+    # This uses the indices that slice produces to make this test more readable
+    # due to how splice processes None being a little complex
+    assert_all_examples(
+        st.slices(size),
+        lambda x: (
+            x.indices(size)[0] + x.indices(size)[2] <= size
+            and x.indices(size)[0] + x.indices(size)[2] >= -1
+        )
+        or x.start == x.stop,
+    )
+
+
+@use_several_sizes
+def test_step_will_not_be_zero(size):
+    assert_all_examples(st.slices(size), lambda x: x.step != 0)
+
+
+@use_several_sizes
+def test_slices_will_shrink(size):
+    sliced = minimal(st.slices(size))
+    assert sliced.start == 0 or sliced.start is None
+    assert sliced.stop == 0 or sliced.stop is None
+    assert sliced.step == 1
+
+
+@given(st.integers(1, 1000))
+@settings(deadline=None)
+def test_step_will_be_negative(size):
+    find_any(st.slices(size), lambda x: x.step < 0)
+
+
+@given(st.integers(1, 1000))
+@settings(deadline=None)
+def test_step_will_be_positive(size):
+    find_any(st.slices(size), lambda x: x.step > 0)
+
+
+@given(st.integers(1, 10))
+@settings(deadline=None)
+def test_stop_will_equal_size(size):
+    find_any(st.slices(size), lambda x: x.stop == size)
+
+
+@given(st.integers(1, 10))
+@settings(deadline=None)
+def test_start_will_equal_size(size):
+    find_any(st.slices(size), lambda x: x.start == size - 1)
+
+
+@given(st.integers(1, 1000))
+@settings(deadline=None)
+def test_start_will_equal_0(size):
+    find_any(st.slices(size), lambda x: x.start == 0)
+
+
+@given(st.integers(1, 1000))
+@settings(deadline=None)
+def test_start_will_equal_stop(size):
+    find_any(st.slices(size), lambda x: x.start == x.stop)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_type_lookup.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_type_lookup.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_type_lookup.py
   2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_type_lookup.py
   2019-05-09 08:15:59.000000000 +0200
@@ -31,6 +31,7 @@
 )
 from hypothesis.internal.compat import PY2, integer_types
 from hypothesis.searchstrategy import types
+from hypothesis.searchstrategy.types import _global_type_lookup
 from tests.common.utils import checks_deprecated_behaviour
 
 # Build a set of all types output by core strategies
@@ -218,3 +219,12 @@
 def test_uninspectable_from_type():
     with pytest.raises(TypeError, match="object is not callable"):
         st.from_type(BrokenClass).example()
+
+
[email protected](
+    "typ", sorted([x for x in _global_type_lookup if x.__module__ != 
"typing"], key=str)
+)
+@given(data=st.data())
+def test_can_generate_from_all_registered_types(data, typ):
+    value = data.draw(st.from_type(typ), label="value")
+    assert isinstance(value, typ)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_unittest.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_unittest.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/cover/test_unittest.py
      2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/cover/test_unittest.py
      2019-05-09 08:15:59.000000000 +0200
@@ -55,4 +55,3 @@
 
     def test(self):
         """Provide something to set up for, so the setUp method is called."""
-        pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/nocover/test_from_type_recipe.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/nocover/test_from_type_recipe.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/nocover/test_from_type_recipe.py
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/nocover/test_from_type_recipe.py
    2019-05-09 08:15:59.000000000 +0200
@@ -0,0 +1,49 @@
+# coding=utf-8
+#
+# This file is part of Hypothesis, which may be found at
+# https://github.com/HypothesisWorks/hypothesis/
+#
+# Most of this work is copyright (C) 2013-2019 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 https://mozilla.org/MPL/2.0/.
+#
+# END HEADER
+
+from __future__ import absolute_import, division, print_function
+
+import hypothesis.strategies as st
+from hypothesis import given
+from hypothesis.searchstrategy.types import _global_type_lookup
+
+
+def everything_except(excluded_types):
+    """Recipe copied from the docstring of ``from_type``"""
+    return (
+        st.from_type(type)
+        .flatmap(st.from_type)
+        .filter(lambda x: not isinstance(x, excluded_types))
+    )
+
+
+@given(
+    excluded_types=st.lists(
+        st.sampled_from(
+            sorted(
+                [x for x in _global_type_lookup if x.__module__ != "typing"], 
key=str
+            )
+        ),
+        min_size=1,
+        max_size=3,
+        unique=True,
+    ).map(tuple),
+    data=st.data(),
+)
+def test_recipe_for_everything_except(excluded_types, data):
+    value = data.draw(everything_except(excluded_types))
+    assert not isinstance(value, excluded_types)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/nocover/test_modify_inner_test.py
 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/nocover/test_modify_inner_test.py
--- 
old/hypothesis-hypothesis-python-4.22.0/hypothesis-python/tests/nocover/test_modify_inner_test.py
   2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/hypothesis-python/tests/nocover/test_modify_inner_test.py
   2019-05-09 08:15:59.000000000 +0200
@@ -30,7 +30,6 @@
     For example, pytest-trio would take the inner test, wrap it in an
     async-to-sync converter, and use the new func (not always_passes).
     """
-    pass
 
 
 @given(st.integers())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/requirements/tools.in 
new/hypothesis-hypothesis-python-4.23.4/requirements/tools.in
--- old/hypothesis-hypothesis-python-4.22.0/requirements/tools.in       
2019-05-07 05:30:36.000000000 +0200
+++ new/hypothesis-hypothesis-python-4.23.4/requirements/tools.in       
2019-05-09 08:15:59.000000000 +0200
@@ -1,4 +1,5 @@
 attrs
+autoflake
 bandit
 black
 coverage
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/requirements/tools.txt 
new/hypothesis-hypothesis-python-4.23.4/requirements/tools.txt
--- old/hypothesis-hypothesis-python-4.22.0/requirements/tools.txt      
2019-05-07 05:30:36.000000000 +0200
+++ new/hypothesis-hypothesis-python-4.23.4/requirements/tools.txt      
2019-05-09 08:15:59.000000000 +0200
@@ -9,6 +9,7 @@
 astroid==2.2.5            # via pylint
 atomicwrites==1.3.0       # via pytest
 attrs==19.1.0
+autoflake==1.3
 babel==2.6.0              # via sphinx
 backcall==0.1.0           # via ipython
 bandit==1.5.1
@@ -61,7 +62,7 @@
 py==1.8.0                 # via pytest, tox
 pycodestyle==2.5.0        # via flake8
 pydocstyle==3.0.0         # via flake8-docstrings
-pyflakes==2.1.1           # via flake8
+pyflakes==2.1.1           # via autoflake, flake8
 pygithub==1.43.7          # via pyupio
 pygments==2.3.1           # via ipython, readme-renderer, sphinx
 pyjwt==1.7.1              # via pygithub
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/tooling/src/hypothesistooling/__main__.py
 
new/hypothesis-hypothesis-python-4.23.4/tooling/src/hypothesistooling/__main__.py
--- 
old/hypothesis-hypothesis-python-4.22.0/tooling/src/hypothesistooling/__main__.py
   2019-05-07 05:30:36.000000000 +0200
+++ 
new/hypothesis-hypothesis-python-4.23.4/tooling/src/hypothesistooling/__main__.py
   2019-05-09 08:15:59.000000000 +0200
@@ -221,8 +221,18 @@
                 o.write("\n\n")
                 o.write(source)
             o.write("\n")
-    pip_tool("isort", *files_to_format)
 
+    pip_tool(
+        "autoflake",
+        "--recursive",
+        "--in-place",
+        "--exclude=compat.py",
+        "--remove-all-unused-imports",
+        "--remove-duplicate-keys",
+        "--remove-unused-variables",
+        *files_to_format,
+    )
+    pip_tool("isort", *files_to_format)
     pip_tool("black", *files_to_format)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hypothesis-hypothesis-python-4.22.0/whole-repo-tests/test_type_hints.py 
new/hypothesis-hypothesis-python-4.23.4/whole-repo-tests/test_type_hints.py
--- old/hypothesis-hypothesis-python-4.22.0/whole-repo-tests/test_type_hints.py 
2019-05-07 05:30:36.000000000 +0200
+++ new/hypothesis-hypothesis-python-4.23.4/whole-repo-tests/test_type_hints.py 
2019-05-09 08:15:59.000000000 +0200
@@ -44,10 +44,13 @@
     # See https://mypy.readthedocs.io/en/latest/common_issues.html#reveal-type
     # The shell output for `reveal_type([1, 2, 3])` looks like a literal:
     # file.py:2: error: Revealed type is 'builtins.list[builtins.int*]'
-    typ = out.split("error: Revealed type is ")[1].strip().strip("'")
-    qualname = "hypothesis.searchstrategy.strategies.SearchStrategy"
-    assert typ.startswith(qualname)
-    return typ[len(qualname) + 1 : -1].replace("builtins.", "").replace("*", 
"")
+    return (
+        out.split("error: Revealed type is ")[1]
+        .strip()
+        .strip("'")
+        .replace("builtins.", "")
+        .replace("*", "")
+    )
 
 
 @pytest.mark.parametrize(
@@ -59,6 +62,7 @@
         ("booleans().filter(bool)", "bool"),
         ("lists(none())", "list[None]"),
         ("dictionaries(integers(), datetimes())", "dict[int, 
datetime.datetime]"),
+        ("data()", "hypothesis._strategies.DataObject"),
         # Ex`-1 stands for recursion in the whole type, i.e. Ex`0 == Union[...]
         ("recursive(integers(), lists)", "Union[list[Ex`-1], int]"),
         # See https://github.com/python/mypy/issues/5269 - fix the hints on
@@ -74,5 +78,17 @@
         "s = {}\n"
         "reveal_type(s)\n".format(val)
     )
-    got = get_mypy_analysed_type(str(f.realpath()), val)
-    assert got == expect
+    typ = get_mypy_analysed_type(str(f.realpath()), val)
+    assert typ == "hypothesis.searchstrategy.strategies.SearchStrategy[%s]" % 
expect
+
+
+def test_data_object_type_tracing(tmpdir):
+    f = tmpdir.join("chech_mypy_on_st_data.py")
+    f.write(
+        "from hypothesis.strategies import data, integers\n"
+        "d = data().example()\n"
+        "s = d.draw(integers())\n"
+        "reveal_type(s)\n"
+    )
+    got = get_mypy_analysed_type(str(f.realpath()), "data().draw(integers())")
+    assert got == "int"


Reply via email to