Skip to content

Commit 0edd448

Browse files
committed
Merge pull request #2 from satra/enh/py3k-fix
fix: simplified doc test
2 parents b25c202 + 06c0293 commit 0edd448

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

nipype/pipeline/utils.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -323,29 +323,16 @@ def synchronize_iterables(iterables):
323323
>>> from nipype.pipeline.utils import synchronize_iterables
324324
>>> iterables = dict(a=lambda: [1, 2], b=lambda: [3, 4])
325325
>>> synced = synchronize_iterables(iterables)
326-
>>> [val['a'] for val in synced]
327-
[1, 2]
328-
>>> [val['b'] for val in synced]
329-
[3, 4]
330-
326+
>>> synced == [{'a': 1, 'b': 3}, {'a': 2, 'b': 4}]
327+
True
331328
>>> iterables = dict(a=lambda: [1, 2], b=lambda: [3], c=lambda: [4, 5, 6])
332329
>>> synced = synchronize_iterables(iterables)
333-
>>> [len(d) for d in synced]
334-
[3, 2, 1]
335-
>>> [d.get('a', None) for d in synced]
336-
[1, 2, None]
337-
>>> [d.get('b', None) for d in synced]
338-
[3, None, None]
339-
>>> [d.get('c', None) for d in synced]
340-
[4, 5, 6]
330+
>>> synced == [{'a': 1, 'b': 3, 'c': 4}, {'a': 2, 'c': 5}, {'c': 6}]
331+
True
341332
"""
342-
# Convert the (field, function) tuples into (field, value) lists
343-
def nextval(val):
344-
yield next(iter(val))
345-
346333
out_list = []
347334
iterable_items = [(field, iter(fvals()))
348-
for field, fvals in iterables.items()]
335+
for field, fvals in sorted(iterables.items())]
349336
while True:
350337
cur_dict = {}
351338
for field, iter_values in iterable_items:

0 commit comments

Comments
 (0)