mirror of https://github.com/jab/bidict.git
Use one_of rather than sampled_from in hypothesis tests.
This commit is contained in:
parent
b5d2d393c3
commit
f1493e0778
|
@ -18,17 +18,22 @@ from . import _types as t
|
||||||
|
|
||||||
MAX = int(getenv('HYPOTHESIS_GEN_MAX_SIZE', '0')) or None
|
MAX = int(getenv('HYPOTHESIS_GEN_MAX_SIZE', '0')) or None
|
||||||
|
|
||||||
|
|
||||||
|
def one_of(items):
|
||||||
|
return st.one_of((st.just(i) for i in items))
|
||||||
|
|
||||||
|
|
||||||
DATA = st.data()
|
DATA = st.data()
|
||||||
BIDICT_TYPES = st.sampled_from(t.BIDICT_TYPES)
|
BIDICT_TYPES = one_of(t.BIDICT_TYPES)
|
||||||
MUTABLE_BIDICT_TYPES = st.sampled_from(t.MUTABLE_BIDICT_TYPES)
|
MUTABLE_BIDICT_TYPES = one_of(t.MUTABLE_BIDICT_TYPES)
|
||||||
FROZEN_BIDICT_TYPES = st.sampled_from(t.FROZEN_BIDICT_TYPES)
|
FROZEN_BIDICT_TYPES = one_of(t.FROZEN_BIDICT_TYPES)
|
||||||
ORDERED_BIDICT_TYPES = st.sampled_from(t.ORDERED_BIDICT_TYPES)
|
ORDERED_BIDICT_TYPES = one_of(t.ORDERED_BIDICT_TYPES)
|
||||||
REVERSIBLE_BIDICT_TYPES = st.sampled_from(t.REVERSIBLE_BIDICT_TYPES)
|
REVERSIBLE_BIDICT_TYPES = one_of(t.REVERSIBLE_BIDICT_TYPES)
|
||||||
MAPPING_TYPES = st.sampled_from(t.MAPPING_TYPES)
|
MAPPING_TYPES = one_of(t.MAPPING_TYPES)
|
||||||
NON_BI_MAPPING_TYPES = st.sampled_from(t.NON_BI_MAPPING_TYPES)
|
NON_BI_MAPPING_TYPES = one_of(t.NON_BI_MAPPING_TYPES)
|
||||||
ORDERED_MAPPING_TYPES = st.sampled_from(t.ORDERED_MAPPING_TYPES)
|
ORDERED_MAPPING_TYPES = one_of(t.ORDERED_MAPPING_TYPES)
|
||||||
HASHABLE_MAPPING_TYPES = st.sampled_from(t.HASHABLE_MAPPING_TYPES)
|
HASHABLE_MAPPING_TYPES = one_of(t.HASHABLE_MAPPING_TYPES)
|
||||||
ON_DUP_ACTIONS = st.sampled_from((DROP_NEW, DROP_OLD, RAISE))
|
ON_DUP_ACTIONS = one_of((DROP_NEW, DROP_OLD, RAISE))
|
||||||
ON_DUP = st.tuples(ON_DUP_ACTIONS, ON_DUP_ACTIONS, ON_DUP_ACTIONS).map(OnDup._make)
|
ON_DUP = st.tuples(ON_DUP_ACTIONS, ON_DUP_ACTIONS, ON_DUP_ACTIONS).map(OnDup._make)
|
||||||
|
|
||||||
TEXT = st.text()
|
TEXT = st.text()
|
||||||
|
|
Loading…
Reference in New Issue