diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-07-15 19:11:36 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-07-15 19:11:36 (GMT) |
commit | ced770da07f9dbd7cc3afd09c2488c60faefe73c (patch) | |
tree | 6f1d9e1e50dabdcbd5ca7d38bdd0396ca60989bb /Lib/test/test_timeit.py | |
parent | 76d508b5d4bc8d69433956d6ee6309bbc31f3cf7 (diff) | |
download | cpython-ced770da07f9dbd7cc3afd09c2488c60faefe73c.zip cpython-ced770da07f9dbd7cc3afd09c2488c60faefe73c.tar.gz cpython-ced770da07f9dbd7cc3afd09c2488c60faefe73c.tar.bz2 |
Issue #24631: Fixed regression in the timeit modulu with multyline setup.
Diffstat (limited to 'Lib/test/test_timeit.py')
-rw-r--r-- | Lib/test/test_timeit.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_timeit.py b/Lib/test/test_timeit.py index 5e9d49e..2db3c1b 100644 --- a/Lib/test/test_timeit.py +++ b/Lib/test/test_timeit.py @@ -88,8 +88,8 @@ class TestTimeit(unittest.TestCase): self.assertRaises(SyntaxError, timeit.Timer, setup='continue') self.assertRaises(SyntaxError, timeit.Timer, setup='from timeit import *') - fake_setup = "import timeit; timeit._fake_timer.setup()" - fake_stmt = "import timeit; timeit._fake_timer.inc()" + fake_setup = "import timeit\ntimeit._fake_timer.setup()" + fake_stmt = "import timeit\ntimeit._fake_timer.inc()" def fake_callable_setup(self): self.fake_timer.setup() @@ -272,6 +272,12 @@ class TestTimeit(unittest.TestCase): self.assertEqual(s, "CustomSetup\n" * 3 + "35 loops, best of 3: 2 sec per loop\n") + def test_main_multiple_setups(self): + s = self.run_main(seconds_per_increment=2.0, + switches=['-n35', '-s', 'a = "CustomSetup"', '-s', 'print(a)']) + self.assertEqual(s, "CustomSetup\n" * 3 + + "35 loops, best of 3: 2 sec per loop\n") + def test_main_fixed_reps(self): s = self.run_main(seconds_per_increment=60.0, switches=['-r9']) self.assertEqual(s, "10 loops, best of 9: 60 sec per loop\n") |