mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 17:52:50 +00:00
Hypothesis-based roundtrip test.
This commit is contained in:
parent
828e6bc28a
commit
6464e226c6
@ -1,5 +1,10 @@
|
||||
import random, unittest
|
||||
|
||||
from hypothesis import (
|
||||
strategies as st,
|
||||
given,
|
||||
)
|
||||
|
||||
from allmydata.util import base62, mathutil
|
||||
|
||||
def insecurerandstr(n):
|
||||
@ -14,6 +19,10 @@ class T(unittest.TestCase):
|
||||
bs2=base62.a2b(ascii)
|
||||
assert bs2 == bs, "bs2: %s:%s, bs: %s:%s, ascii: %s:%s" % (len(bs2), repr(bs2), len(bs), repr(bs), len(ascii), repr(ascii))
|
||||
|
||||
@given(input_bytes=st.binary(max_size=100))
|
||||
def test_roundtrip(self, input_bytes):
|
||||
self._test_ende(input_bytes)
|
||||
|
||||
def test_num_octets_that_encode_to_this_many_chars(self):
|
||||
return self._test_num_octets_that_encode_to_this_many_chars(2, 1)
|
||||
return self._test_num_octets_that_encode_to_this_many_chars(3, 2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user