Commit 269c886d authored by Jérome Perrin's avatar Jérome Perrin

py3: do not use xrange

parent c07ed743
...@@ -42,7 +42,7 @@ if getZopeVersion() < (4, ): ...@@ -42,7 +42,7 @@ if getZopeVersion() < (4, ):
def getRandomString(): def getRandomString():
return "test.%s" %"".join([random.choice(string.ascii_letters + string.digits) for _ in xrange(32)]) return "test.%s" %"".join([random.choice(string.ascii_letters + string.digits) for _ in range(32)])
class TestDataIngestion(ERP5TypeTestCase): class TestDataIngestion(ERP5TypeTestCase):
......
...@@ -49,11 +49,11 @@ if getZopeVersion() < (4, ): # BBB Zope2 ...@@ -49,11 +49,11 @@ if getZopeVersion() < (4, ): # BBB Zope2
def getRandomString(): def getRandomString():
return 'test_%s' %''.join([random.choice(string.ascii_letters + string.digits) \ return 'test_%s' %''.join([random.choice(string.ascii_letters + string.digits) \
for _ in xrange(32)]) for _ in range(32)])
def chunks(l, n): def chunks(l, n):
"""Yield successive n-sized chunks from l.""" """Yield successive n-sized chunks from l."""
for i in xrange(0, len(l), n): for i in range(0, len(l), n):
yield l[i:i+n] yield l[i:i+n]
class Test(ERP5TypeTestCase): class Test(ERP5TypeTestCase):
...@@ -275,7 +275,7 @@ class Test(ERP5TypeTestCase): ...@@ -275,7 +275,7 @@ class Test(ERP5TypeTestCase):
bucket_stream.insertBucket(i, i*10000) bucket_stream.insertBucket(i, i*10000)
self.assertEqual(100, len(bucket_stream)) self.assertEqual(100, len(bucket_stream))
self.assertEqual(range(100), bucket_stream.getKeyList()) self.assertEqual(list(range(100)), bucket_stream.getKeyList())
# test as sequence # test as sequence
bucket = bucket_stream.getBucketKeyItemSequenceByKey(start_key=10, count=1)[0] bucket = bucket_stream.getBucketKeyItemSequenceByKey(start_key=10, count=1)[0]
......
...@@ -34,7 +34,7 @@ class TestDataIngestion(SecurityTestCase): ...@@ -34,7 +34,7 @@ class TestDataIngestion(SecurityTestCase):
self.assertEqual(self.PART_1, self.REFERENCE_SEPARATOR + self.portal.ERP5Site_getIngestionReferenceDictionary()["split_first_suffix"]) self.assertEqual(self.PART_1, self.REFERENCE_SEPARATOR + self.portal.ERP5Site_getIngestionReferenceDictionary()["split_first_suffix"])
def getRandomReference(self): def getRandomReference(self):
random_string = ''.join([random.choice(string.ascii_letters + string.digits) for _ in xrange(10)]) random_string = ''.join([random.choice(string.ascii_letters + string.digits) for _ in range(10)])
return 'UNIT-TEST-' + random_string return 'UNIT-TEST-' + random_string
def getIngestionReference(self, reference, extension, randomize_ingestion_reference=False, data_set_reference=False): def getIngestionReference(self, reference, extension, randomize_ingestion_reference=False, data_set_reference=False):
...@@ -58,7 +58,7 @@ class TestDataIngestion(SecurityTestCase): ...@@ -58,7 +58,7 @@ class TestDataIngestion(SecurityTestCase):
return self.REF_SUPPLIER_PREFIX + ingestion_reference + self.REFERENCE_SEPARATOR + self.REFERENCE_SEPARATOR + str("") + self.REFERENCE_SEPARATOR + "" return self.REF_SUPPLIER_PREFIX + ingestion_reference + self.REFERENCE_SEPARATOR + self.REFERENCE_SEPARATOR + str("") + self.REFERENCE_SEPARATOR + ""
def chunks(self, l, n): def chunks(self, l, n):
for i in xrange(0, len(l), n): for i in range(0, len(l), n):
yield l[i:i+n] yield l[i:i+n]
def getDataIngestion(self, reference): def getDataIngestion(self, reference):
...@@ -154,13 +154,13 @@ class TestDataIngestion(SecurityTestCase): ...@@ -154,13 +154,13 @@ class TestDataIngestion(SecurityTestCase):
chunks). chunks).
""" """
data_chunk_1 = ''.join([random.choice(string.ascii_letters + string.digits) \ data_chunk_1 = ''.join([random.choice(string.ascii_letters + string.digits) \
for _ in xrange(250)]) for _ in range(250)])
data_chunk_2 = ''.join([random.choice(string.ascii_letters + string.digits) \ data_chunk_2 = ''.join([random.choice(string.ascii_letters + string.digits) \
for _ in xrange(250)]) for _ in range(250)])
data_chunk_3 = ''.join([random.choice(string.ascii_letters + string.digits) \ data_chunk_3 = ''.join([random.choice(string.ascii_letters + string.digits) \
for _ in xrange(250)]) for _ in range(250)])
data_chunk_4 = ''.join([random.choice(string.ascii_letters + string.digits) \ data_chunk_4 = ''.join([random.choice(string.ascii_letters + string.digits) \
for _ in xrange(250)]) for _ in range(250)])
reference = self.getRandomReference() reference = self.getRandomReference()
......
...@@ -11,7 +11,7 @@ import string ...@@ -11,7 +11,7 @@ import string
def getRandomString(): def getRandomString():
return 'test_%s' %''.join([random.choice(string.ascii_letters + string.digits) \ return 'test_%s' %''.join([random.choice(string.ascii_letters + string.digits) \
for _ in xrange(32)]) for _ in range(32)])
# Game of Life examples # Game of Life examples
default_input_ndarray = np.array([[0,0,0,0,0,0], default_input_ndarray = np.array([[0,0,0,0,0,0],
......
import pandas as pd import pandas as pd
import numpy as np import numpy as np
import re import re
from six.moves import range
import transaction import transaction
from DateTime import DateTime from DateTime import DateTime
from wendelin.bigarray.array_zodb import ZBigArray from wendelin.bigarray.array_zodb import ZBigArray
...@@ -58,7 +59,7 @@ class ZBigArrayConverter(object): ...@@ -58,7 +59,7 @@ class ZBigArrayConverter(object):
data_array = result[0] data_array = result[0]
array = data_array.getArray() array = data_array.getArray()
for index in xrange(len(array)): for index in range(len(array)):
# We need to order everything related to the data schema here. The Results methods # We need to order everything related to the data schema here. The Results methods
# `tuples()`, `names` and `data_dictionary` returns the fields in a different order # `tuples()`, `names` and `data_dictionary` returns the fields in a different order
# and order is very important in the conversion to a ZBigArray. So we build # and order is very important in the conversion to a ZBigArray. So we build
...@@ -179,7 +180,7 @@ class ZBigArrayExtender(object): ...@@ -179,7 +180,7 @@ class ZBigArrayExtender(object):
extension_dtype = DtypeIdentifier(self.extension).identify() extension_dtype = DtypeIdentifier(self.extension).identify()
if not self.source.dtype == extension_dtype: if not self.source.dtype == extension_dtype:
raise TypeError('Source and extension data types does not match.') raise TypeError('Source and extension data types does not match.')
for index in xrange(len(self.extension)): for index in range(len(self.extension)):
# Basically the same problem here with the order of Results instance fields # Basically the same problem here with the order of Results instance fields
# when we convert it to an array. # when we convert it to an array.
ordered_movements = [] ordered_movements = []
......
...@@ -18,7 +18,7 @@ if user_quantity is None: ...@@ -18,7 +18,7 @@ if user_quantity is None:
"error_message": "Parameter 'user_quantity' is required.", "error_message": "Parameter 'user_quantity' is required.",
"password" : None }) "password" : None })
password = ''.join(random.choice(string.digits + string.letters) for i in xrange(10)) password = ''.join(random.choice(string.digits + string.letters) for i in range(10))
# check erp5_scalability_test business template is present # check erp5_scalability_test business template is present
configurator = portal.business_configuration_module.default_wendelin_configuration configurator = portal.business_configuration_module.default_wendelin_configuration
......
...@@ -17,7 +17,7 @@ try: ...@@ -17,7 +17,7 @@ try:
organisation = organisation.getRelativeUrl() organisation = organisation.getRelativeUrl()
for i in xrange(0, int(user_quantity)): for i in range(0, int(user_quantity)):
user_id = "scalability_user_%i" % i user_id = "scalability_user_%i" % i
person = portal_catalog.getResultValue( person = portal_catalog.getResultValue(
portal_type="Person", portal_type="Person",
......
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