diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-28 09:15:16 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-28 09:24:47 +0300 |
commit | 7bdac764bdb7155a75887725c96743faf3af2871 (patch) | |
tree | d5146d80b9e2e7a2c9928b739a38b78e6819f536 /contrib/python/hypothesis/py3 | |
parent | d4d193c13a5c0c9911ae5cec21f49b777f4b2469 (diff) | |
download | ydb-7bdac764bdb7155a75887725c96743faf3af2871.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/hypothesis/py3')
5 files changed, 43 insertions, 34 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index 76ffe52c50..f04833c544 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.101.0 +Version: 6.102.1 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/engine.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py index 070d460def..b828fb0998 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py @@ -1072,20 +1072,23 @@ class ConjectureRunner: failed_mutations += 1 continue - assert isinstance(new_data, ConjectureResult) - if ( - new_data.status >= data.status - and data.buffer != new_data.buffer - and all( - k in new_data.target_observations - and new_data.target_observations[k] >= v - for k, v in data.target_observations.items() - ) - ): - data = new_data - failed_mutations = 0 + if new_data is Overrun: + failed_mutations += 1 # pragma: no cover # annoying case else: - failed_mutations += 1 + assert isinstance(new_data, ConjectureResult) + if ( + new_data.status >= data.status + and data.buffer != new_data.buffer + and all( + k in new_data.target_observations + and new_data.target_observations[k] >= v + for k, v in data.target_observations.items() + ) + ): + data = new_data + failed_mutations = 0 + else: + failed_mutations += 1 def optimise_targets(self) -> None: """If any target observations have been made, attempt to optimise them diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py index 7c4e584ee6..46c4339fab 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/types.py @@ -291,14 +291,18 @@ def get_constraints_filter_map(): def _get_constraints(args: Tuple[Any, ...]) -> Iterator["at.BaseMetadata"]: - if at := sys.modules.get("annotated_types"): - for arg in args: - if isinstance(arg, at.BaseMetadata): - yield arg - elif getattr(arg, "__is_annotated_types_grouped_metadata__", False): - yield from arg - elif isinstance(arg, slice) and arg.step in (1, None): - yield from at.Len(arg.start or 0, arg.stop) + at = sys.modules.get("annotated_types") + for arg in args: + if at and isinstance(arg, at.BaseMetadata): + yield arg + elif getattr(arg, "__is_annotated_types_grouped_metadata__", False): + for subarg in arg: + if getattr(subarg, "__is_annotated_types_grouped_metadata__", False): + yield from _get_constraints(tuple(subarg)) + else: + yield subarg + elif at and isinstance(arg, slice) and arg.step in (1, None): + yield from at.Len(arg.start or 0, arg.stop) def _flat_annotated_repr_parts(annotated_type): @@ -341,16 +345,18 @@ def find_annotated_strategy(annotated_type): return arg filter_conditions = [] - if "annotated_types" in sys.modules: - unsupported = [] - for constraint in _get_constraints(metadata): - if convert := get_constraints_filter_map().get(type(constraint)): - filter_conditions.append(convert(constraint)) - else: - unsupported.append(constraint) - if unsupported: - msg = f"Ignoring unsupported {', '.join(map(repr, unsupported))}" - warnings.warn(msg, HypothesisWarning, stacklevel=2) + unsupported = [] + constraints_map = get_constraints_filter_map() + for constraint in _get_constraints(metadata): + if isinstance(constraint, st.SearchStrategy): + return constraint + if convert := constraints_map.get(type(constraint)): + filter_conditions.append(convert(constraint)) + else: + unsupported.append(constraint) + if unsupported: + msg = f"Ignoring unsupported {', '.join(map(repr, unsupported))}" + warnings.warn(msg, HypothesisWarning, stacklevel=2) base_strategy = st.from_type(annotated_type.__origin__) for filter_condition in filter_conditions: diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index b4d1cbcc8c..1da3483a7d 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, 101, 0) +__version_info__ = (6, 102, 1) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 8ae370f338..79efe78dc3 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.101.0) +VERSION(6.102.1) LICENSE(MPL-2.0) |