Debian Codegraph @

hypothesis-python/tests/cover/test_shrink_budgeting.py

raw
1 # This file is part of Hypothesis, which may be found at
2 # https://github.com/HypothesisWorks/hypothesis/
3 #
4 # Copyright the Hypothesis Authors.
5 # Individual contributors are listed in AUTHORS.rst and the git log.
6 #
7 # This Source Code Form is subject to the terms of the Mozilla Public License,
8 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
9 # obtain one at https://mozilla.org/MPL/2.0/.
10
11 import sys
12
13 import pytest
14
15 from hypothesis.internal.conjecture.shrinking import Integer, Ordering
16
17
18 @pytest.mark.parametrize(
19 "Shrinker, value",
20 [
21 (Integer, 2**16),
22 (Integer, int(sys.float_info.max)),
23 (Ordering, [(100,) * 10]),
24 (Ordering, [i * 100 for i in (range(5))]),
25 (Ordering, [i * 100 for i in reversed(range(5))]),
26 ],
27 )
28 def test_meets_budgetary_requirements(Shrinker, value):
29 shrinker = Shrinker(value, lambda x: x == value)
30 shrinker.run()
31 assert shrinker.calls <= 10