Debian Codegraph @

hypothesis-python/tests/quality/test_integers.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 from hypothesis import given, settings, strategies as st
12
13
14 def test_biases_towards_boundary_values():
15 trillion = 10**12
16 boundary_vals = {-trillion, -trillion + 1, trillion - 1, trillion}
17
18 @given(st.integers(-trillion, trillion))
19 @settings(max_examples=1000)
20 def f(n):
21 boundary_vals.discard(n)
22
23 f()
24
25 assert (
26 not boundary_vals
27 ), f"Expected to see all boundary vals, but still have {boundary_vals}"