Lines Matching refs:timeit
1 import timeit
12 # timeit's default number of iterations.
15 # timeit's default number of repetitions.
30 timeit._fake_timer = self
50 del timeit._fake_timer
55 self.assertEqual(timeit.reindent("", 0), "")
56 self.assertEqual(timeit.reindent("", 4), "")
59 self.assertEqual(timeit.reindent("pass", 0), "pass")
60 self.assertEqual(timeit.reindent("pass", 4), "pass")
63 self.assertEqual(timeit.reindent("\n\n", 0), "\n\n")
64 self.assertEqual(timeit.reindent("\n\n", 4), "\n \n ")
67 self.assertEqual(timeit.reindent(
70 self.assertEqual(timeit.reindent(
75 self.assertRaises(ValueError, timeit.Timer, stmt=None)
76 self.assertRaises(SyntaxError, timeit.Timer, stmt='return')
77 self.assertRaises(SyntaxError, timeit.Timer, stmt='yield')
78 self.assertRaises(SyntaxError, timeit.Timer, stmt='break')
79 self.assertRaises(SyntaxError, timeit.Timer, stmt='continue')
82 self.assertRaises(ValueError, timeit.Timer, setup=None)
83 self.assertRaises(SyntaxError, timeit.Timer, setup='return')
84 self.assertRaises(SyntaxError, timeit.Timer, setup='yield')
85 self.assertRaises(SyntaxError, timeit.Timer, setup='break')
86 self.assertRaises(SyntaxError, timeit.Timer, setup='continue')
88 fake_setup = "import timeit; timeit._fake_timer.setup()"
89 fake_stmt = "import timeit; timeit._fake_timer.inc()"
97 def timeit(self, stmt, setup, number=None):
99 t = timeit.Timer(stmt=stmt, setup=setup, timer=self.fake_timer)
105 delta_time = t.timeit(**kwargs)
112 # self.timeit(self.fake_stmt, self.fake_setup)
115 self.timeit(self.fake_stmt, self.fake_setup, number=0)
118 self.timeit(self.fake_stmt, self.fake_setup, number=3)
121 self.timeit(self.fake_callable_stmt, self.fake_setup, number=3)
124 self.timeit(self.fake_stmt, self.fake_callable_setup, number=3)
127 self.timeit(self.fake_callable_stmt,
132 # delta_time = timeit.timeit(self.fake_stmt, self.fake_setup,
137 delta_time = timeit.timeit(self.fake_stmt, self.fake_setup, number=0,
143 t = timeit.Timer(stmt=stmt, setup=setup, timer=self.fake_timer)
185 # delta_times = timeit.repeat(self.fake_stmt, self.fake_setup,
190 delta_times = timeit.repeat(self.fake_stmt, self.fake_setup, repeat=0,
195 delta_times = timeit.repeat(self.fake_stmt, self.fake_setup, number=0,
207 t = timeit.Timer("1.0/0.0")
209 t.timeit()
224 # timeit.main() modifies sys.path, so save and restore it.
227 timeit.main(args=args, _wrap_timer=timer.wrap_timer)
271 self.assertEqual(s, timeit.__doc__)