mirror of
https://github.com/romanz/amodem.git
synced 2026-04-20 13:07:56 +08:00
common: add capture for iterator results
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user