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 "DataObject",
69 "DrawFn",
70 "SearchStrategy",
71 "binary",
72 "booleans",
73 "builds",
74 "characters",
75 "complex_numbers",
76 "composite",
77 "data",
78 "dates",
79 "datetimes",
80 "decimals",
81 "deferred",
82 "dictionaries",
83 "emails",
84 "fixed_dictionaries",
85 "floats",
86 "fractions",
87 "from_regex",
88 "from_type",
89 "frozensets",
90 "functions",
91 "integers",
92 "ip_addresses",
93 "iterables",
94 "just",
95 "lists",
96 "none",
97 "nothing",
98 "one_of",
99 "permutations",
100 "random_module",
101 "randoms",
102 "recursive",
103 "register_type_strategy",
104 "runner",
105 "sampled_from",
106 "sets",
107 "shared",
108 "slices",
109 "text",
110 "timedeltas",
111 "times",
112 "timezone_keys",
113 "timezones",
114 "tuples",
115 "uuids",
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