Show More
@@ -234,6 +234,19 b' class TestView(ClusterTestCase):' | |||||
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 |
|
236 | |||
|
237 | @skip_without('numpy') | |||
|
238 | def test_apply_numpy(self): | |||
|
239 | """view.apply(f, ndarray)""" | |||
|
240 | import numpy | |||
|
241 | from numpy.testing.utils import assert_array_equal, assert_array_almost_equal | |||
|
242 | ||||
|
243 | A = numpy.random.random((100,100)) | |||
|
244 | view = self.client[-1] | |||
|
245 | for dt in [ 'int32', 'uint8', 'float32', 'float64' ]: | |||
|
246 | B = A.astype(dt) | |||
|
247 | C = view.apply_sync(lambda x:x, B) | |||
|
248 | assert_array_equal(B,C) | |||
|
249 | ||||
237 | def test_map(self): |
|
250 | def test_map(self): | |
238 | view = self.client[:] |
|
251 | view = self.client[:] | |
239 | def f(x): |
|
252 | def f(x): |
@@ -41,10 +41,14 b' from zmq.log import handlers' | |||||
41 |
|
41 | |||
42 | # IPython imports |
|
42 | # IPython imports | |
43 | from IPython.config.application import Application |
|
43 | from IPython.config.application import Application | |
|
44 | from IPython.utils import py3compat | |||
44 | from IPython.utils.pickleutil import can, uncan, canSequence, uncanSequence |
|
45 | from IPython.utils.pickleutil import can, uncan, canSequence, uncanSequence | |
45 | from IPython.utils.newserialized import serialize, unserialize |
|
46 | from IPython.utils.newserialized import serialize, unserialize | |
46 | from IPython.zmq.log import EnginePUBHandler |
|
47 | from IPython.zmq.log import EnginePUBHandler | |
47 |
|
48 | |||
|
49 | if py3compat.PY3: | |||
|
50 | buffer = memoryview | |||
|
51 | ||||
48 | #----------------------------------------------------------------------------- |
|
52 | #----------------------------------------------------------------------------- | |
49 | # Classes |
|
53 | # Classes | |
50 | #----------------------------------------------------------------------------- |
|
54 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now