diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-01 08:14:44 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-01 08:23:22 +0300 |
commit | 2a3178dcfd26fc0bbd8f07409ca880f7b7f39a8b (patch) | |
tree | 317aaf3f7f88d69867860e2de5388c34e324d8f8 /contrib/python/hypothesis/py3 | |
parent | 33bd3dfbfe7a189db201a984903c52c465332299 (diff) | |
download | ydb-2a3178dcfd26fc0bbd8f07409ca880f7b7f39a8b.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/hypothesis/py3')
6 files changed, 38 insertions, 10 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index c2000db5a1..9780b83140 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.98.5 +Version: 6.98.6 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 1f56d2ccf3..cea40823be 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py @@ -1589,7 +1589,9 @@ class ConjectureData: if forced is not None: assert allow_nan or not math.isnan(forced) - assert math.isnan(forced) or min_value <= forced <= max_value + assert math.isnan(forced) or ( + sign_aware_lte(min_value, forced) and sign_aware_lte(forced, max_value) + ) kwargs: FloatKWargs = { "min_value": min_value, diff --git a/contrib/python/hypothesis/py3/hypothesis/stateful.py b/contrib/python/hypothesis/py3/hypothesis/stateful.py index 14275d940e..2ae5815161 100644 --- a/contrib/python/hypothesis/py3/hypothesis/stateful.py +++ b/contrib/python/hypothesis/py3/hypothesis/stateful.py @@ -233,11 +233,12 @@ class StateMachineMeta(type): class RuleBasedStateMachine(metaclass=StateMachineMeta): """A RuleBasedStateMachine gives you a structured way to define state machines. - The idea is that a state machine carries a bunch of types of data - divided into Bundles, and has a set of rules which may read data - from bundles (or just from normal strategies) and push data onto - bundles. At any given point a random applicable rule will be - executed. + The idea is that a state machine carries the system under test and some supporting + data. This data can be stored in instance variables or + divided into Bundles. The state machine has a set of rules which may read data + from bundles (or just from normal strategies), push data onto + bundles, change the state of the machine, or verify properties. + At any given point a random applicable rule will be executed. """ _rules_per_class: ClassVar[Dict[type, List[classmethod]]] = {} @@ -459,6 +460,27 @@ class BundleReferenceStrategy(SearchStrategy): class Bundle(SearchStrategy[Ex]): + """A collection of values for use in stateful testing. + + Bundles are a kind of strategy where values can be added by rules, + and (like any strategy) used as inputs to future rules. + + The ``name`` argument they are passed is the they are referred to + internally by the state machine; no two bundles may have + the same name. It is idiomatic to use the attribute + being assigned to as the name of the Bundle:: + + class MyStateMachine(RuleBasedStateMachine): + keys = Bundle("keys") + + Bundles can contain the same value more than once; this becomes + relevant when using :func:`~hypothesis.stateful.consumes` to remove + values again. + + If the ``consume`` argument is set to True, then all values that are + drawn from this bundle will be consumed (as above) when requested. + """ + def __init__(self, name: str, *, consume: bool = False) -> None: self.name = name self.__reference_strategy = BundleReferenceStrategy(name, consume=consume) @@ -638,7 +660,7 @@ def rule( ``targets`` will define where the end result of this function should go. If both are empty then the end result will be discarded. - ``target`` must be a Bundle, or if the result should go to multiple + ``target`` must be a Bundle, or if the result should be replicated to multiple bundles you can pass a tuple of them as the ``targets`` argument. It is invalid to use both arguments for a single rule. If the result should go to exactly one of several bundles, define a separate rule for diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py index 97dd2bf9b3..1efe75caec 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py @@ -2104,6 +2104,10 @@ def runner(*, default: Any = not_set) -> SearchStrategy[Any]: The exact meaning depends on the entry point, but it will usually be the associated 'self' value for it. + If you are using this in a rule for stateful testing, this strategy + will return the instance of the :class:`~hypothesis.stateful.RuleBasedStateMachine` + that the rule is running for. + If there is no current test runner and a default is provided, return that default. If no default is provided, raises InvalidArgument. diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index 65284f2d57..43ec273cc1 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, 98, 5) +__version_info__ = (6, 98, 6) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index c07c5f7974..5da3870659 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.98.5) +VERSION(6.98.6) LICENSE(MPL-2.0) |