##// END OF EJS Templates
Merge pull request #5766 from minrk/map-length-0...
Thomas Kluyver -
r16513:7aeb0546 merge
parent child Browse files
Show More
@@ -1,20 +1,7 b''
1 """Remote Functions and decorators for Views.
1 """Remote Functions and decorators for Views."""
2 2
3 Authors:
4
5 * Brian Granger
6 * Min RK
7 """
8 #-----------------------------------------------------------------------------
9 # Copyright (C) 2010-2011 The IPython Development Team
10 #
11 # Distributed under the terms of the BSD License. The full license is in
12 # the file COPYING, distributed as part of this software.
13 #-----------------------------------------------------------------------------
14
15 #-----------------------------------------------------------------------------
16 # Imports
17 #-----------------------------------------------------------------------------
3 # Copyright (c) IPython Development Team.
4 # Distributed under the terms of the Modified BSD License.
18 5
19 6 from __future__ import division
20 7
@@ -203,6 +190,10 b' class ParallelFunction(RemoteFunction):'
203 190 minlen = n
204 191 lens.append(n)
205 192
193 if maxlen == 0:
194 # nothing to iterate over
195 return []
196
206 197 # check that the length of sequences match
207 198 if not self._mapping and minlen != maxlen:
208 199 msg = 'all sequences must have equal length, but have %s' % lens
@@ -1,20 +1,8 b''
1 1 # -*- coding: utf-8 -*-
2 """test View objects
2 """test View objects"""
3 3
4 Authors:
5
6 * Min RK
7 """
8 #-------------------------------------------------------------------------------
9 # Copyright (C) 2011 The IPython Development Team
10 #
11 # Distributed under the terms of the BSD License. The full license is in
12 # the file COPYING, distributed as part of this software.
13 #-------------------------------------------------------------------------------
14
15 #-------------------------------------------------------------------------------
16 # Imports
17 #-------------------------------------------------------------------------------
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
18 6
19 7 import base64
20 8 import sys
@@ -347,6 +335,11 b' class TestView(ClusterTestCase):'
347 335 r = view.map_sync(f, data)
348 336 self.assertEqual(r, list(map(f, data)))
349 337
338 def test_map_empty_sequence(self):
339 view = self.client[:]
340 r = view.map_sync(lambda x: x, [])
341 self.assertEqual(r, [])
342
350 343 def test_map_iterable(self):
351 344 """test map on iterables (direct)"""
352 345 view = self.client[:]
General Comments 0
You need to be logged in to leave comments. Login now