common: add capture for iterator results

This commit is contained in:
Roman Zeyde
2014-07-08 08:34:36 +03:00
committed by Roman Zeyde
parent 69f8666445
commit fa40381248
2 changed files with 14 additions and 0 deletions

View File

@@ -29,3 +29,12 @@ def test_split():
assert False
except IndexError as e:
assert e.args == (i,)
def test_icapture():
x = range(100)
y = []
z = []
for i in common.icapture(x, result=y):
z.append(i)
assert x == y
assert x == z