--- /dev/null
+from hypothesis.strategies import binary
+from hypothesis.strategies import booleans
+from hypothesis.strategies import characters
+from hypothesis.strategies import datetimes
+from hypothesis.strategies import integers
+from hypothesis.strategies import just
+from hypothesis.strategies import none
+from hypothesis.strategies import one_of
+from hypothesis.strategies import text
+from hypothesis.strategies import tuples
+from hypothesis.strategies import uuids
+
+from pyac import Blob
+
+
+blobs_st = tuples(integers(1, 20), binary(max_size=60)).map(lambda x: Blob(*x))
+unicode_allowed = characters(exclude_characters="\x00", exclude_categories=("Cs",))
+text_st = text(alphabet=unicode_allowed, max_size=32)
+mapkey_st = text(alphabet=unicode_allowed, min_size=1, max_size=8)
+any_st = one_of(
+ booleans(),
+ integers(),
+ just(0),
+ just(-1),
+ binary(max_size=32),
+ text_st,
+ none(),
+ uuids(),
+ datetimes(),
+)
from hypothesis import given
from hypothesis.strategies import binary
-from hypothesis.strategies import booleans
-from hypothesis.strategies import characters
-from hypothesis.strategies import datetimes
-from hypothesis.strategies import integers
-from hypothesis.strategies import just
from hypothesis.strategies import lists
-from hypothesis.strategies import none
-from hypothesis.strategies import one_of
-from hypothesis.strategies import text
-from hypothesis.strategies import tuples
-from hypothesis.strategies import uuids
-from pyac import Blob
from pyac import dumps
from pyac import loads
from pyac import NotEnoughData
-
-
-blobs_st = tuples(integers(1, 20), binary(max_size=60)).map(lambda x: Blob(*x))
-
-text_st = text(
- alphabet=characters(exclude_characters="\x00", exclude_categories=("Cs",)),
- max_size=32,
-)
-
-any_st = one_of(
- booleans(),
- integers(),
- just(0),
- just(-1),
- binary(max_size=32),
- text_st,
- none(),
- uuids(),
- datetimes(),
-)
+from tests.strategies import any_st
class TestList(TestCase):
from hypothesis import given
from hypothesis.strategies import binary
-from hypothesis.strategies import booleans
-from hypothesis.strategies import characters
-from hypothesis.strategies import datetimes
from hypothesis.strategies import dictionaries
-from hypothesis.strategies import integers
-from hypothesis.strategies import just
from hypothesis.strategies import lists
-from hypothesis.strategies import none
-from hypothesis.strategies import one_of
-from hypothesis.strategies import text
-from hypothesis.strategies import tuples
-from hypothesis.strategies import uuids
-from pyac import Blob
-from pyac import dumps
from pyac import DecodeError
+from pyac import dumps
from pyac import loads
-
-
-blobs_st = tuples(integers(1, 20), binary(max_size=60)).map(lambda x: Blob(*x))
-
-text_st = text(
- alphabet=characters(exclude_characters="\x00", exclude_categories=("Cs",)),
- max_size=32,
-)
-
-any_st = one_of(
- booleans(),
- integers(),
- just(0),
- just(-1),
- binary(max_size=32),
- text_st,
- none(),
- uuids(),
- datetimes(),
-)
-
-mapkey_st = text(
- alphabet=characters(exclude_characters="\x00", exclude_categories=("Cs",)),
- min_size=1,
- max_size=8,
-)
+from tests.strategies import any_st
+from tests.strategies import mapkey_st
class TestMap(TestCase):
from hypothesis import given
from hypothesis.strategies import binary
-from hypothesis.strategies import booleans
-from hypothesis.strategies import characters
-from hypothesis.strategies import datetimes
from hypothesis.strategies import deferred
from hypothesis.strategies import dictionaries
-from hypothesis.strategies import integers
-from hypothesis.strategies import just
from hypothesis.strategies import lists
-from hypothesis.strategies import none
-from hypothesis.strategies import one_of
-from hypothesis.strategies import text
-from hypothesis.strategies import tuples
-from hypothesis.strategies import uuids
-from pyac import Blob
from pyac import dumps
from pyac import loads
+from tests.strategies import any_st
+from tests.strategies import mapkey_st
-blobs_st = tuples(integers(1, 20), binary(max_size=60)).map(lambda x: Blob(*x))
-
-text_st = text(
- alphabet=characters(exclude_characters="\x00", exclude_categories=("Cs",)),
- max_size=32,
-)
-
-mapkey_st = text(
- alphabet=characters(exclude_characters="\x00", exclude_categories=("Cs",)),
- min_size=1,
- max_size=8,
-)
-
-any_st = one_of(
- booleans(),
- integers(),
- just(0),
- just(-1),
- binary(max_size=32),
- text_st,
- none(),
- uuids(),
- datetimes(),
-)
-
everything_st = deferred(
lambda: any_st |
lists(everything_st, max_size=4) |
- dictionaries(
- mapkey_st,
- everything_st,
- max_size=4,
- )
+ dictionaries(mapkey_st, everything_st, max_size=4)
)