kopia lustrzana https://github.com/micropython/micropython-lib
itertools: test_itertools.py: Test for islice() on generator.
rodzic
7bbdc050d3
commit
47c4ef54bc
|
@ -3,3 +3,9 @@ import itertools
|
|||
assert list(itertools.islice(list(range(10)), 4)) == [0, 1, 2, 3]
|
||||
assert list(itertools.islice(list(range(10)), 2, 6)) == [2, 3, 4, 5]
|
||||
assert list(itertools.islice(list(range(10)), 2, 6, 2)) == [2, 4]
|
||||
|
||||
def g():
|
||||
while True:
|
||||
yield 123
|
||||
|
||||
assert list(itertools.islice(g(), 5)) == [123, 123, 123, 123, 123]
|
||||
|
|
Ładowanie…
Reference in New Issue