diff --git a/tests/property_tests/_strategies.py b/tests/property_tests/_strategies.py index 5d5c924..52f9ed5 100644 --- a/tests/property_tests/_strategies.py +++ b/tests/property_tests/_strategies.py @@ -18,17 +18,22 @@ from . import _types as t 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() -BIDICT_TYPES = st.sampled_from(t.BIDICT_TYPES) -MUTABLE_BIDICT_TYPES = st.sampled_from(t.MUTABLE_BIDICT_TYPES) -FROZEN_BIDICT_TYPES = st.sampled_from(t.FROZEN_BIDICT_TYPES) -ORDERED_BIDICT_TYPES = st.sampled_from(t.ORDERED_BIDICT_TYPES) -REVERSIBLE_BIDICT_TYPES = st.sampled_from(t.REVERSIBLE_BIDICT_TYPES) -MAPPING_TYPES = st.sampled_from(t.MAPPING_TYPES) -NON_BI_MAPPING_TYPES = st.sampled_from(t.NON_BI_MAPPING_TYPES) -ORDERED_MAPPING_TYPES = st.sampled_from(t.ORDERED_MAPPING_TYPES) -HASHABLE_MAPPING_TYPES = st.sampled_from(t.HASHABLE_MAPPING_TYPES) -ON_DUP_ACTIONS = st.sampled_from((DROP_NEW, DROP_OLD, RAISE)) +BIDICT_TYPES = one_of(t.BIDICT_TYPES) +MUTABLE_BIDICT_TYPES = one_of(t.MUTABLE_BIDICT_TYPES) +FROZEN_BIDICT_TYPES = one_of(t.FROZEN_BIDICT_TYPES) +ORDERED_BIDICT_TYPES = one_of(t.ORDERED_BIDICT_TYPES) +REVERSIBLE_BIDICT_TYPES = one_of(t.REVERSIBLE_BIDICT_TYPES) +MAPPING_TYPES = one_of(t.MAPPING_TYPES) +NON_BI_MAPPING_TYPES = one_of(t.NON_BI_MAPPING_TYPES) +ORDERED_MAPPING_TYPES = one_of(t.ORDERED_MAPPING_TYPES) +HASHABLE_MAPPING_TYPES = one_of(t.HASHABLE_MAPPING_TYPES) +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) TEXT = st.text()