Commit f4c2fc6a authored by Julien Muchembled's avatar Julien Muchembled

qa: remove a few uses of 'chr'

parent 1316c225
...@@ -21,6 +21,7 @@ from .. import NeoUnitTestBase, buildUrlFromString ...@@ -21,6 +21,7 @@ from .. import NeoUnitTestBase, buildUrlFromString
from neo.client.app import Application from neo.client.app import Application
from neo.client.cache import test as testCache from neo.client.cache import test as testCache
from neo.client.exception import NEOStorageError from neo.client.exception import NEOStorageError
from neo.lib.util import p64
class ClientApplicationTests(NeoUnitTestBase): class ClientApplicationTests(NeoUnitTestBase):
...@@ -51,9 +52,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -51,9 +52,7 @@ class ClientApplicationTests(NeoUnitTestBase):
def makeOID(self, value=None): def makeOID(self, value=None):
from random import randint from random import randint
if value is None: return p64(randint(1, 255) if value is None else value)
value = randint(1, 255)
return '\00' * 7 + chr(value)
makeTID = makeOID makeTID = makeOID
def makeTransactionObject(self, user='u', description='d', _extension='e'): def makeTransactionObject(self, user='u', description='d', _extension='e'):
......
...@@ -22,7 +22,7 @@ PROD1 = lambda random=random: DummyZODB(6.04237779991, 1.55811487853, ...@@ -22,7 +22,7 @@ PROD1 = lambda random=random: DummyZODB(6.04237779991, 1.55811487853,
def DummyData(random=random): def DummyData(random=random):
# returns data that gzip at about 28.5 % # returns data that gzip at about 28.5 %
# make sure sample is bigger than dictionary of compressor # make sure sample is bigger than dictionary of compressor
data = ''.join(chr(int(random.gauss(0, .8)) % 256) for x in xrange(100000)) data = bytearray(int(random.gauss(0, .8)) % 256 for x in xrange(100000))
return StringIO(data) return StringIO(data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment