예제 #1
0
 def __init__(self, inputs):
     self.collection = [peekable(input) for input in inputs]
     self.collection = sorted(self.collection, key=self._key)
예제 #2
0
 def test_iter(self):
     actual = [x for x in peekable(range(4))]
     eq_(actual, [0, 1, 2, 3])
예제 #3
0
 def test_get_one(self):
     p = peekable(range(4))
     eq_(p.peek(), 0)
     eq_(p.next(), 0)
예제 #4
0
 def test_look_ahead_then_grab_some(self):
     p = peekable(range(4))
     eq_(p.peek(3), [0, 1, 2])
     eq_(p.next(2), [0, 1])
예제 #5
0
 def test_walking_off_the_end(self):
     p = peekable(range(100))
     assert_raises(StopIteration, p.peek, 101)
     eq_(p.peek(1), [0])
     assert_raises(StopIteration, p.next, 101)
     eq_(p.next(1), [0])
예제 #6
0
 def test_get_one(self):
     p = peekable(range(4))
     eq_(p.peek(), 0)
     eq_(p.next(), 0)
예제 #7
0
 def test_get_list(self):
     p = peekable(range(4))
     eq_(p.peek(1), [0])
     eq_(p.next(1), [0])
예제 #8
0
 def test_iter(self):
     actual = [x for x in peekable(range(4))]
     eq_(actual, [0, 1, 2, 3])
예제 #9
0
 def test_walking_off_the_end(self):
     p = peekable(range(100))
     assert_raises(StopIteration, p.peek, 101)
     eq_(p.peek(1), [0])
     assert_raises(StopIteration, p.next, 101)
     eq_(p.next(1), [0])
예제 #10
0
 def test_look_ahead_then_grab_some(self):
     p = peekable(range(4))
     eq_(p.peek(3), [0, 1, 2])
     eq_(p.next(2), [0, 1])
예제 #11
0
 def test_get_list(self):
     p = peekable(range(4))
     eq_(p.peek(1), [0])
     eq_(p.next(1), [0])
예제 #12
0
 def __init__(self, inputs):
     self.collection = [peekable(input) for input in inputs]
     self.collection = sorted(self.collection, key=self._key)