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
11from hypothesis.strategies._internal import SearchStrategy
12from hypothesis.strategies._internal.collections import tuples
13from hypothesis.strategies._internal.core import (
14 DataObject,
15 DrawFn,
16 binary,
17 booleans,
18 builds,
19 characters,
20 complex_numbers,
21 composite,
22 data,
23 decimals,
24 deferred,
25 dictionaries,
26 emails,
27 fixed_dictionaries,
28 fractions,
29 from_regex,
30 from_type,
31 frozensets,
32 functions,
33 iterables,
34 lists,
35 permutations,
36 random_module,
37 randoms,
38 recursive,
39 register_type_strategy,
40 runner,
41 sampled_from,
42 sets,
43 shared,
44 slices,
45 text,
46 uuids,
47)
48from hypothesis.strategies._internal.datetime import (
49 dates,
50 datetimes,
51 timedeltas,
52 times,
53 timezone_keys,
54 timezones,
55)
56from hypothesis.strategies._internal.ipaddress import ip_addresses
57from hypothesis.strategies._internal.misc import just, none, nothing
58from hypothesis.strategies._internal.numbers import floats, integers
59from hypothesis.strategies._internal.strategies import one_of
60from hypothesis.strategies._internal.utils import _strategies
61
62# The implementation of all of these lives in `_strategies.py`, but we
63# re-export them via this module to avoid exposing implementation details
64# to over-zealous tab completion in editors that do not respect __all__.
65
66
67__all__ = [
68 "binary",
69 "booleans",
70 "builds",
71 "characters",
72 "complex_numbers",
73 "composite",
74 "data",
75 "DataObject",
76 "dates",
77 "datetimes",
78 "decimals",
79 "deferred",
80 "dictionaries",
81 "DrawFn",
82 "emails",
83 "fixed_dictionaries",
84 "floats",
85 "fractions",
86 "from_regex",
87 "from_type",
88 "frozensets",
89 "functions",
90 "integers",
91 "ip_addresses",
92 "iterables",
93 "just",
94 "lists",
95 "none",
96 "nothing",
97 "one_of",
98 "permutations",
99 "random_module",
100 "randoms",
101 "recursive",
102 "register_type_strategy",
103 "runner",
104 "sampled_from",
105 "sets",
106 "shared",
107 "slices",
108 "text",
109 "timedeltas",
110 "times",
111 "timezone_keys",
112 "timezones",
113 "tuples",
114 "uuids",
115 "SearchStrategy",
116]
117
118
119def _check_exports(_public):
120 assert set(__all__) == _public, (set(__all__) - _public, _public - set(__all__))
121
122 # Verify that all exported strategy functions were registered with
123 # @declares_strategy.
124
125 existing_strategies = set(_strategies) - {"_maybe_nil_uuids"}
126
127 exported_strategies = set(__all__) - {
128 "DataObject",
129 "DrawFn",
130 "SearchStrategy",
131 "composite",
132 "register_type_strategy",
133 }
134 assert existing_strategies == exported_strategies, (
135 existing_strategies - exported_strategies,
136 exported_strategies - existing_strategies,
137 )
138
139
140_check_exports({n for n in dir() if n[0] not in "_@"})
141del _check_exports