def testProgressNotCalled(self): func_counter = 0 def Func() -> None: nonlocal func_counter func_counter += 1 time.Sleep(42.0, progress_secs=108.0, progress_callback=Func) self.assertEqual(func_counter, 0) self.assertEqual(sum(self.sleeps), 42.0)
def testNoProgress(self): time.Sleep(42.0) self.assertEqual(sum(self.sleeps), 42.0)
def testZero(self): time.Sleep(0.0) self.assertEqual(sum(self.sleeps), 0.0)
def Sleep(secs: float) -> None: time.Sleep( secs, progress_secs=opts.progress_interval, progress_callback=opts.progress_callback)
def testNonPositiveProgress(self): with self.assertRaisesRegex(ValueError, "Non-positive"): time.Sleep(1.0, progress_secs=0.0)
def testNegative(self): with self.assertRaisesRegex(ValueError, "Negative"): time.Sleep(-1.0)