diff options
Diffstat (limited to 'tests/test_test_utils.py')
-rw-r--r-- | tests/test_test_utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_test_utils.py b/tests/test_test_utils.py index 11c5db3cd9..dcf946fc1a 100644 --- a/tests/test_test_utils.py +++ b/tests/test_test_utils.py @@ -28,3 +28,25 @@ class MockClockTestCase(unittest.TestCase): self.clock.advance_time(20) self.assertEquals(20, self.clock.time() - start_time) + + def test_later(self): + invoked = [0, 0] + + def _cb0(): + invoked[0] = 1 + self.clock.call_later(10, _cb0) + + def _cb1(): + invoked[1] = 1 + self.clock.call_later(20, _cb1) + + self.assertFalse(invoked[0]) + + self.clock.advance_time(15) + + self.assertTrue(invoked[0]) + self.assertFalse(invoked[1]) + + self.clock.advance_time(5) + + self.assertTrue(invoked[1]) |