summaryrefslogtreecommitdiffstats
path: root/contrib/python/hypothesis/py3
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2024-08-12 09:28:59 +0300
committerrobot-piglet <[email protected]>2024-08-12 09:38:32 +0300
commit257897ca64dd6a9c71b917b128ec453a36d6d8a1 (patch)
treeaa22a80b0de2e8b7f4de8f3f5593fac9942af14a /contrib/python/hypothesis/py3
parent480038df25b9267a11b390666e5077cad0529a5e (diff)
Intermediate changes
Diffstat (limited to 'contrib/python/hypothesis/py3')
-rw-r--r--contrib/python/hypothesis/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py12
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py20
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/version.py2
-rw-r--r--contrib/python/hypothesis/py3/ya.make2
5 files changed, 20 insertions, 18 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA
index 223aafcb694..f8369495489 100644
--- a/contrib/python/hypothesis/py3/.dist-info/METADATA
+++ b/contrib/python/hypothesis/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: hypothesis
-Version: 6.108.4
+Version: 6.108.5
Summary: A library for property-based testing
Home-page: https://hypothesis.works
Author: David R. MacIver and Zac Hatfield-Dodds
diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py
index 6c68b441d6d..3f81f262ebc 100644
--- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py
+++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py
@@ -2083,11 +2083,17 @@ class ConjectureData:
assert len(weights) == width
if forced is not None and (min_value is None or max_value is None):
- # We draw `forced=forced - shrink_towards` here internally. If that
- # grows larger than a 128 bit signed integer, we can't represent it.
+ # We draw `forced=forced - shrink_towards` here internally, after clamping.
+ # If that grows larger than a 128 bit signed integer, we can't represent it.
# Disallow this combination for now.
# Note that bit_length() = 128 -> signed bit size = 129.
- assert (forced - shrink_towards).bit_length() < 128
+ _shrink_towards = shrink_towards
+ if min_value is not None:
+ _shrink_towards = max(min_value, _shrink_towards)
+ if max_value is not None:
+ _shrink_towards = min(max_value, _shrink_towards)
+
+ assert (forced - _shrink_towards).bit_length() < 128
if forced is not None and min_value is not None:
assert min_value <= forced
if forced is not None and max_value is not None:
diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py
index ead0157395e..c5602a35f4a 100644
--- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py
+++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py
@@ -285,22 +285,18 @@ def all_children(ir_type, kwargs):
continue
yield n
else:
- # hard case: only one bound was specified. Here we probe either upwards
- # or downwards with our full 128 bit generation, but only half of these
- # (plus one for the case of generating zero) result in a probe in the
- # direction we want. ((2**128 - 1) // 2) + 1 == a range of 2 ** 127.
- #
- # strictly speaking, I think this is not actually true: if
- # max_value > shrink_towards then our range is ((-2**127) + 1, max_value),
- # and it only narrows when max_value < shrink_towards. But it
- # really doesn't matter for this case because (even half) unbounded
- # integers generation is hit extremely rarely.
assert (min_value is None) ^ (max_value is None)
+ # hard case: only one bound was specified. Here we probe in 128 bits
+ # around shrink_towards, and discard those above max_value or below
+ # min_value respectively.
+ shrink_towards = kwargs["shrink_towards"]
if min_value is None:
- yield from range(max_value - (2**127) + 1, max_value)
+ shrink_towards = min(max_value, shrink_towards)
+ yield from range(shrink_towards - (2**127) + 1, max_value)
else:
assert max_value is None
- yield from range(min_value, min_value + (2**127) - 1)
+ shrink_towards = max(min_value, shrink_towards)
+ yield from range(min_value, shrink_towards + (2**127) - 1)
if ir_type == "boolean":
p = kwargs["p"]
diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py
index 29e2144b92a..7a526dd733a 100644
--- a/contrib/python/hypothesis/py3/hypothesis/version.py
+++ b/contrib/python/hypothesis/py3/hypothesis/version.py
@@ -8,5 +8,5 @@
# 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/.
-__version_info__ = (6, 108, 4)
+__version_info__ = (6, 108, 5)
__version__ = ".".join(map(str, __version_info__))
diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make
index 4efa89329dd..172daf15d17 100644
--- a/contrib/python/hypothesis/py3/ya.make
+++ b/contrib/python/hypothesis/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(6.108.4)
+VERSION(6.108.5)
LICENSE(MPL-2.0)