]> code.communitydata.science - rises_declines_wikia_code.git/blob - mediawiki_dump_tools/Mediawiki-Utilities/mw/util/iteration/tests/test_peekable.py
Initial commit
[rises_declines_wikia_code.git] / mediawiki_dump_tools / Mediawiki-Utilities / mw / util / iteration / tests / test_peekable.py
1 from nose.tools import eq_
2 from ..peekable import Peekable
3
4
5 def test_peekable():
6     iterable = range(0, 100)
7     iterable = Peekable(iterable)
8     expected = list(range(0, 100))
9
10     result = []
11
12     assert not iterable.empty()
13     eq_(iterable.peek(), expected[0])
14     result.append(next(iterable))
15
16     eq_(iterable.peek(), expected[1])
17     result.append(next(iterable))
18
19     result.extend(list(iterable))
20     eq_(result, expected)

Community Data Science Collective || Want to submit a patch?