Debian Codegraph @

hypothesis-python/tests/nocover/test_bad_repr.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, strategies as st
12
13
14 class BadRepr:
15 def __init__(self, value):
16 self.value = value
17
18 def __repr__(self):
19 return self.value
20
21
22 Frosty = BadRepr("☃")
23
24
25 def test_just_frosty():
26 assert repr(st.just(Frosty)) == "just(☃)"
27
28
29 def test_sampling_snowmen():
30 assert repr(st.sampled_from((Frosty, "hi"))) == "sampled_from((☃, 'hi'))"
31
32
33 def varargs(*args, **kwargs):
34 pass
35
36
37 @given(
38 st.sampled_from(
39 [
40 "✐",
41 "✑",
42 "✒",
43 "✓",
44 "✔",
45 "✕",
46 "✖",
47 "✗",
48 "✘",
49 "✙",
50 "✚",
51 "✛",
52 "✜",
53 "✝",
54 "✞",
55 "✟",
56 "✠",
57 "✡",
58 "✢",
59 "✣",
60 ]
61 )
62 )
63 def test_sampled_from_bad_repr(c):
64 pass