diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-01-27 16:19:29 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-01-27 16:36:53 +0300 |
commit | 6e1358a430ae27360d66469823eb84f18a5342c3 (patch) | |
tree | a0119df212eddfeecff76ade94cf61424ef5d12d /contrib | |
parent | ad927abd4d5d013a42581b3624c513e96da236a2 (diff) | |
download | ydb-6e1358a430ae27360d66469823eb84f18a5342c3.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib')
6 files changed, 14 insertions, 14 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index b4f00cf430..0a1a43dcfa 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.92.8 +Version: 6.92.9 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 7a5542b0bd..1939e337b3 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py @@ -30,6 +30,7 @@ from typing import ( Set, Tuple, Type, + TypeVar, Union, ) @@ -88,6 +89,8 @@ InterestingOrigin = Tuple[ ] TargetObservations = Dict[Optional[str], Union[int, float]] +T = TypeVar("T") + class ExtraInformation: """A class for holding shared state on a ``ConjectureData`` that should @@ -1719,6 +1722,11 @@ class ConjectureData: self.buffer = bytes(self.buffer) self.observer.conclude_test(self.status, self.interesting_origin) + def choice(self, values: Sequence[T], *, forced: Optional[T] = None) -> T: + forced_i = None if forced is None else values.index(forced) + i = self.draw_integer(0, len(values) - 1, forced=forced_i) + return values[i] + def draw_bits(self, n: int, *, forced: Optional[int] = None) -> int: """Return an ``n``-bit integer from the underlying source of bytes. If ``forced`` is set to an integer will instead diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/utils.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/utils.py index 0712b2d8c8..97b913d79e 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/utils.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/utils.py @@ -81,14 +81,6 @@ def check_sample( return tuple(values) -def choice( - data: "ConjectureData", values: Sequence[T], *, forced: Optional[T] = None -) -> T: - forced_i = None if forced is None else values.index(forced) - i = data.draw_integer(0, len(values) - 1, forced=forced_i) - return values[i] - - class Sampler: """Sampler based on Vose's algorithm for the alias method. See http://www.keithschwarz.com/darts-dice-coins/ for a good explanation. @@ -182,8 +174,8 @@ class Sampler: if forced is None else next((b, a, a_c) for (b, a, a_c) in self.table if forced in (b, a)) ) - base, alternate, alternate_chance = choice( - data, self.table, forced=forced_choice + base, alternate, alternate_chance = data.choice( + self.table, forced=forced_choice ) use_alternate = data.draw_boolean( alternate_chance, forced=None if forced is None else forced == alternate diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py index f2cc0925a5..d2b33f2673 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/strategies.py @@ -602,7 +602,7 @@ class SampledFromStrategy(SearchStrategy): # The speculative index didn't work out, but at this point we've built # and can choose from the complete list of allowed indices and elements. if allowed: - i, element = cu.choice(data, allowed) + i, element = data.choice(allowed) data.draw_integer(0, len(self.elements) - 1, forced=i) return element # If there are no allowed indices, the filter couldn't be satisfied. diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index ef8fe6a63a..d8124dcc31 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, 92, 8) +__version_info__ = (6, 92, 9) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 92b1d0c734..cb04686d6e 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.92.8) +VERSION(6.92.9) LICENSE(MPL-2.0) |