Debian Codegraph @

hypothesis-python/tests/nocover/test_sets.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
12 from hypothesis.strategies import floats, integers, sets
13
14 from tests.common.debug import find_any
15
16
17 def test_can_draw_sets_of_hard_to_find_elements():
18 rarebool = floats(0, 1).map(lambda x: x <= 0.05)
19 find_any(sets(rarebool, min_size=2), settings=settings(deadline=None))
20
21
22 @given(sets(integers(), max_size=0))
23 def test_empty_sets(x):
24 assert x == set()
25
26
27 @given(sets(integers(), max_size=2))
28 def test_bounded_size_sets(x):
29 assert len(x) <= 2