Commit c784186e authored by Jérome Perrin's avatar Jérome Perrin

testOrder: py3 fixes

parent 619924f7
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
# #
############################################################################## ##############################################################################
import unittest import functools
import os import os
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import FileUpload,\ from Products.ERP5Type.tests.utils import FileUpload,\
...@@ -464,7 +465,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): ...@@ -464,7 +465,7 @@ class TestOrderMixin(SubcontentReindexingWrapper):
""" """
Split a list and return tuple with the 2 half Split a list and return tuple with the 2 half
""" """
middle = len(l)/2 + len(l)%2 middle = int(len(l)//2 + len(l)%2)
return ( l[:middle] , l[middle:] ) return ( l[:middle] , l[middle:] )
def stepSetOrderLineHalfVCL(self,sequence=None, sequence_list=None, **kw): def stepSetOrderLineHalfVCL(self,sequence=None, sequence_list=None, **kw):
...@@ -516,7 +517,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): ...@@ -516,7 +517,7 @@ class TestOrderMixin(SubcontentReindexingWrapper):
self.assertEqual(len(cell_key_list), 0) self.assertEqual(len(cell_key_list), 0)
else: else:
len_range = [len(x) for x in cell_range] len_range = [len(x) for x in cell_range]
self.assertEqual(len(cell_key_list), reduce(lambda x,y: x*y, len_range)) self.assertEqual(len(cell_key_list), functools.reduce(lambda x,y: x*y, len_range))
def stepCompleteOrderLineMatrix(self,sequence=None, sequence_list=None, \ def stepCompleteOrderLineMatrix(self,sequence=None, sequence_list=None, \
**kw): **kw):
...@@ -2838,11 +2839,11 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2838,11 +2839,11 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type='Organisation', title='Client', portal_type='Organisation', title='Client',
default_image_file=image) default_image_file=image)
from OFS.Image import Pdata from OFS.Image import Pdata
self.assertTrue(isinstance(client.getDefaultImageValue().data, Pdata)) self.assertIsInstance(client.getDefaultImageValue().data, Pdata)
vendor = self.portal.organisation_module.newContent( vendor = self.portal.organisation_module.newContent(
portal_type='Organisation', title='Vendor', portal_type='Organisation', title='Vendor',
default_image_file=image) default_image_file=image)
self.assertTrue(isinstance(vendor.getDefaultImageValue().data, Pdata)) self.assertIsInstance(vendor.getDefaultImageValue().data, Pdata)
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process, specialise=self.business_process,
......
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