mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-16 15:39:21 +01:00
Add test for structures.TimeoutQueue.__iter__
This commit is contained in:
parent
d0a484c11c
commit
47253e032e
@ -1152,6 +1152,29 @@ class TestTimeoutQueue(SupyTestCase):
|
||||
timeFastForward(1.1)
|
||||
self.assertFalse(1 in q)
|
||||
|
||||
def testIter(self):
|
||||
q = TimeoutQueue(1)
|
||||
q.enqueue(1)
|
||||
it1 = iter(q)
|
||||
timeFastForward(0.5)
|
||||
q.enqueue(2)
|
||||
it2 = iter(q)
|
||||
self.assertEqual(next(it1), 1)
|
||||
self.assertEqual(next(it2), 1)
|
||||
self.assertEqual(next(it2), 2)
|
||||
with self.assertRaises(StopIteration):
|
||||
next(it2)
|
||||
|
||||
timeFastForward(0.6)
|
||||
self.assertEqual(next(it1), 2)
|
||||
with self.assertRaises(StopIteration):
|
||||
next(it1)
|
||||
|
||||
it3 = iter(q)
|
||||
self.assertEqual(next(it3), 2)
|
||||
with self.assertRaises(StopIteration):
|
||||
next(it3)
|
||||
|
||||
def testReset(self):
|
||||
q = TimeoutQueue(10)
|
||||
q.enqueue(1)
|
||||
|
Loading…
Reference in New Issue
Block a user