Commit 8bde5dac authored by Ivan Tyagov's avatar Ivan Tyagov

Fix tests

parent cef88396
...@@ -131,8 +131,15 @@ class Test(ERP5TypeTestCase): ...@@ -131,8 +131,15 @@ class Test(ERP5TypeTestCase):
# make sure real_data tail is also a full line # make sure real_data tail is also a full line
real_data += '\n' real_data += '\n'
_, _, data_stream, data_array = self.stepSetupIngestion(reference) data_stream = portal.data_stream_module.newContent(
portal_type = 'Data Stream',
reference = reference)
data_stream.validate()
data_stream.appendData(real_data) data_stream.appendData(real_data)
data_array = portal.data_array_module.newContent(
portal_type = 'Data Array',
reference = reference)
data_array.validate()
self.tic() self.tic()
self.assertEqual(None, data_array.getArray()) self.assertEqual(None, data_array.getArray())
...@@ -154,6 +161,7 @@ context.activate().DataStream_readChunkListAndTransform( \ ...@@ -154,6 +161,7 @@ context.activate().DataStream_readChunkListAndTransform( \
portal.portal_skins.custom, portal.portal_skins.custom,
script_id, script_id,
*script_content_list) *script_content_list)
self.tic()
number_string_list = [] number_string_list = []
for my_list in list(chunks(range(10001, 200001), 10)): for my_list in list(chunks(range(10001, 200001), 10)):
...@@ -168,6 +176,7 @@ context.activate().DataStream_readChunkListAndTransform( \ ...@@ -168,6 +176,7 @@ context.activate().DataStream_readChunkListAndTransform( \
# test that extracted array contains same values as input CSV # test that extracted array contains same values as input CSV
zarray = data_array.getArray() zarray = data_array.getArray()
self.assertNotEqual(None, data_array.getArray())
expected_numpy_array = np.arange(10001, 200001) expected_numpy_array = np.arange(10001, 200001)
self.assertEqual(np.average(zarray), np.average(expected_numpy_array)) self.assertEqual(np.average(zarray), np.average(expected_numpy_array))
self.assertTrue(np.array_equal(zarray, expected_numpy_array)) self.assertTrue(np.array_equal(zarray, expected_numpy_array))
...@@ -213,10 +222,15 @@ context.activate().DataStream_readChunkListAndTransform( \ ...@@ -213,10 +222,15 @@ context.activate().DataStream_readChunkListAndTransform( \
number_string_list = [row]*20 number_string_list = [row]*20
real_data = '\n'.join(number_string_list) real_data = '\n'.join(number_string_list)
portal.log( real_data) data_stream = portal.data_stream_module.newContent(
portal_type = 'Data Stream',
_, _, data_stream, _ = self.stepSetupIngestion(reference) reference = reference)
data_stream.appendData(real_data) data_stream.appendData(real_data)
data_stream.validate()
data_array = portal.data_array_module.newContent(
portal_type = 'Data Array',
reference = reference)
data_array.validate()
self.tic() self.tic()
data_stream.DataStream_transform(\ data_stream.DataStream_transform(\
......
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