summaryrefslogtreecommitdiffstats
path: root/contrib/python/hypothesis
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2026-02-13 20:16:15 +0300
committerrobot-piglet <[email protected]>2026-02-13 20:43:08 +0300
commit65e07cb4d1079433604272739f4da588ec1ca5aa (patch)
tree4726e65afb0c174f495b78c8dadb06bff87a1837 /contrib/python/hypothesis
parent9abc16a94fc3f1c95b465e4ffb14b828665c8e6c (diff)
Intermediate changes
commit_hash:01f130006286019016512de18d5e3769d76fb3bd
Diffstat (limited to 'contrib/python/hypothesis')
-rw-r--r--contrib/python/hypothesis/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py29
-rw-r--r--contrib/python/hypothesis/py3/hypothesis/version.py2
-rw-r--r--contrib/python/hypothesis/py3/ya.make2
4 files changed, 13 insertions, 22 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA
index 495e87a7de0..813a5d8794f 100644
--- a/contrib/python/hypothesis/py3/.dist-info/METADATA
+++ b/contrib/python/hypothesis/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: hypothesis
-Version: 6.151.3
+Version: 6.151.4
Summary: The property-based testing library for Python
Author-email: "David R. MacIver and Zac Hatfield-Dodds" <[email protected]>
License-Expression: MPL-2.0
diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py
index 8892254e25b..89a3340949d 100644
--- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py
+++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py
@@ -154,23 +154,16 @@ class HealthCheckState:
return "\n".join(out)
-# Stop when 99% confident the true valid rate is below 1%.
-# For k valid examples, we need n invalid such that:
-# P(seeing <= k valid in n+k trials | rate=1%) <= 1%
-# k=0: (0.99)^n <= 0.01 -> n >= ln(0.01)/ln(0.99)
-# Each additional valid example adds ~ln(0.01)/ln(0.99)/3 to threshold.
-def _calculate_thresholds(
- confidence: float = 0.99, min_valid_rate: float = 0.01
-) -> tuple[int, int]:
- log_confidence = math.log(1 - confidence)
- log_invalid_rate = math.log(1 - min_valid_rate)
- base = math.ceil(log_confidence / log_invalid_rate)
- # Approximate increase per valid example (from binomial CDF)
- per_valid = math.ceil(base / 3)
- return base, per_valid
+def _invalid_thresholds(*, r: float, c: float) -> tuple[int, int]:
+ base = math.ceil(math.log(1 - c) / math.log(1 - r)) - 1
+ per_p = math.ceil(1 / r)
+ return base, per_p
-INVALID_THRESHOLD_BASE, INVALID_PER_VALID = _calculate_thresholds()
+# stop once we're 99% confident the true valid rate is below 1%. See
+# https://github.com/HypothesisWorks/hypothesis/issues/4623#issuecomment-3814681997
+# for how we derived this formula.
+INVALID_THRESHOLD_BASE, INVALID_PER_VALID = _invalid_thresholds(r=0.01, c=0.99)
class ExitReason(Enum):
@@ -743,11 +736,9 @@ class ConjectureRunner:
# while in the other case below we just want to move on to shrinking.)
if self.valid_examples >= self.settings.max_examples:
self.exit_with(ExitReason.max_examples)
- # Stop when we're 99% confident the true valid rate is below 1%.
- invalid_threshold = (
+ if (self.invalid_examples + self.overrun_examples) > (
INVALID_THRESHOLD_BASE + INVALID_PER_VALID * self.valid_examples
- )
- if (self.invalid_examples + self.overrun_examples) > invalid_threshold:
+ ):
self.exit_with(ExitReason.max_iterations)
if self.__tree_is_exhausted():
diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py
index 2a6cae682d8..6a327428073 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, 151, 3)
+__version_info__ = (6, 151, 4)
__version__ = ".".join(map(str, __version_info__))
diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make
index da69508f495..8445eaba96a 100644
--- a/contrib/python/hypothesis/py3/ya.make
+++ b/contrib/python/hypothesis/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(6.151.3)
+VERSION(6.151.4)
LICENSE(MPL-2.0)