예제 #1
0
 def test_repr_timeout(self):
     # temporaries only for readability
     timeout = None
     discard = True
     task = executor.Task(lambda: None, timeout, discard)
     msg = repr(task)
     self.assertTrue(msg.startswith('<Task discardable'))
예제 #2
0
 def test_duration_increases(self):
     STEP = 0.1
     TIMES = 3
     task = executor.Task(lambda: None, None)
     task()
     for i in range(TIMES):
         time.sleep(STEP)
         self.assertGreaterEqual(task.duration, i * STEP)
예제 #3
0
 def test_duration_none_if_not_called(self):
     task = executor.Task(lambda: None, None)
     self.assertIs(task.duration, 0)