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

Method test_main_with_time_unit

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

Source from the content-addressed store, hash-verified

332 """))
333
334 def test_main_with_time_unit(self):
335 unit_sec = self.run_main(seconds_per_increment=0.003,
336 switches=['-u', 'sec'])
337 self.assertEqual(unit_sec,
338 "100 loops, best of 5: 0.003 sec per loop\n")
339 unit_msec = self.run_main(seconds_per_increment=0.003,
340 switches=['-u', 'msec'])
341 self.assertEqual(unit_msec,
342 "100 loops, best of 5: 3 msec per loop\n")
343 unit_usec = self.run_main(seconds_per_increment=0.003,
344 switches=['-u', 'usec'])
345 self.assertEqual(unit_usec,
346 "100 loops, best of 5: 3e+03 usec per loop\n")
347 # Test invalid unit input
348 with captured_stderr() as error_stringio:
349 invalid = self.run_main(seconds_per_increment=0.003,
350 switches=['-u', 'parsec'])
351 self.assertEqual(error_stringio.getvalue(),
352 "Unrecognized unit. Please select nsec, usec, msec, or sec.\n")
353
354 def test_main_exception(self):
355 with captured_stderr() as error_stringio:

Callers

nothing calls this directly

Calls 4

run_mainMethod · 0.95
captured_stderrFunction · 0.90
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected