Beispiel #1
0
def test_1():
    it = PeekingIterator(Iterator([1, 2, 3, 4]))
    res = []
    while it.hasNext():
        res.append(it.peek())
        res.append(it.next())
    assert res == [1, 1, 2, 2, 3, 3, 4, 4]
Beispiel #2
0
def test_0():
    it = PeekingIterator(Iterator([]))
    assert not it.hasNext()