MCPcopy Index your code
hub / github.com/python/cpython / test_autorange_with_callback

Method test_autorange_with_callback

Lib/test/test_timeit.py:387–403  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

385 self.assertEqual(time_taken, 2000/1024)
386
387 def test_autorange_with_callback(self):
388 def callback(a, b):
389 print("{} {:.3f}".format(a, b))
390 with captured_stdout() as s:
391 num_loops, time_taken = self.autorange(callback=callback)
392 self.assertEqual(num_loops, 500)
393 self.assertEqual(time_taken, 500/1024)
394 expected = ('1 0.001\n'
395 '2 0.002\n'
396 '5 0.005\n'
397 '10 0.010\n'
398 '20 0.020\n'
399 '50 0.049\n'
400 '100 0.098\n'
401 '200 0.195\n'
402 '500 0.488\n')
403 self.assertEqual(s.getvalue(), expected)
404
405
406if __name__ == '__main__':

Callers

nothing calls this directly

Calls 4

autorangeMethod · 0.95
captured_stdoutFunction · 0.90
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected