MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_autorange_with_callback

Method test_autorange_with_callback

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

Source from the content-addressed store, hash-verified

377 self.assertEqual(time_taken, 1.0)
378
379 def test_autorange_with_callback(self):
380 def callback(a, b):
381 print("{} {:.3f}".format(a, b))
382 with captured_stdout() as s:
383 num_loops, time_taken = self.autorange(callback=callback)
384 self.assertEqual(num_loops, 500)
385 self.assertEqual(time_taken, 500/1024)
386 expected = ('1 0.001\n'
387 '2 0.002\n'
388 '5 0.005\n'
389 '10 0.010\n'
390 '20 0.020\n'
391 '50 0.049\n'
392 '100 0.098\n'
393 '200 0.195\n'
394 '500 0.488\n')
395 self.assertEqual(s.getvalue(), expected)
396
397
398if __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