##// END OF EJS Templates
test that pushing numpy arrays is zero-copy
MinRK -
Show More
@@ -233,6 +233,23 b' class TestView(ClusterTestCase):'
233 view.scatter('a', a)
233 view.scatter('a', a)
234 b = view.gather('a', block=True)
234 b = view.gather('a', block=True)
235 assert_array_equal(b, a)
235 assert_array_equal(b, a)
236
237 @skip_without('numpy')
238 def test_push_numpy_nocopy(self):
239 import numpy
240 view = self.client[:]
241 a = numpy.arange(64)
242 view['A'] = a
243 @interactive
244 def check_writeable(x):
245 return x.flags.writeable
246
247 for flag in view.apply_sync(check_writeable, pmod.Reference('A')):
248 self.assertFalse(flag, "array is writeable, push shouldn't have pickled it")
249
250 view.push(dict(B=a))
251 for flag in view.apply_sync(check_writeable, pmod.Reference('B')):
252 self.assertFalse(flag, "array is writeable, push shouldn't have pickled it")
236
253
237 def test_map(self):
254 def test_map(self):
238 view = self.client[:]
255 view = self.client[:]
General Comments 0
You need to be logged in to leave comments. Login now