mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
Everything should be bytes.
This commit is contained in:
parent
6464e226c6
commit
ead2a79cf7
@ -1,5 +1,7 @@
|
||||
import random, unittest
|
||||
|
||||
from past.builtins import chr as byteschr
|
||||
|
||||
from hypothesis import (
|
||||
strategies as st,
|
||||
given,
|
||||
@ -8,7 +10,7 @@ from hypothesis import (
|
||||
from allmydata.util import base62, mathutil
|
||||
|
||||
def insecurerandstr(n):
|
||||
return ''.join(map(chr, map(random.randrange, [0]*n, [256]*n)))
|
||||
return b''.join(map(byteschr, map(random.randrange, [0]*n, [256]*n)))
|
||||
|
||||
class T(unittest.TestCase):
|
||||
def _test_num_octets_that_encode_to_this_many_chars(self, chars, octets):
|
||||
@ -30,19 +32,19 @@ class T(unittest.TestCase):
|
||||
return self._test_num_octets_that_encode_to_this_many_chars(6, 4)
|
||||
|
||||
def test_ende_0x00(self):
|
||||
return self._test_ende('\x00')
|
||||
return self._test_ende(b'\x00')
|
||||
|
||||
def test_ende_0x01(self):
|
||||
return self._test_ende('\x01')
|
||||
return self._test_ende(b'\x01')
|
||||
|
||||
def test_ende_0x0100(self):
|
||||
return self._test_ende('\x01\x00')
|
||||
return self._test_ende(b'\x01\x00')
|
||||
|
||||
def test_ende_0x000000(self):
|
||||
return self._test_ende('\x00\x00\x00')
|
||||
return self._test_ende(b'\x00\x00\x00')
|
||||
|
||||
def test_ende_0x010000(self):
|
||||
return self._test_ende('\x01\x00\x00')
|
||||
return self._test_ende(b'\x01\x00\x00')
|
||||
|
||||
def test_ende_randstr(self):
|
||||
return self._test_ende(insecurerandstr(2**4))
|
||||
|
Loading…
Reference in New Issue
Block a user