From 951a9e381bd3603ac628dfd519da091d605338b3 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 12 Oct 2012 11:44:10 -0400 Subject: fix to work if __doc__ is removed --- Lib/test/test_runpy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py index 6e9c4fc..96d2beb 100644 --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -523,10 +523,10 @@ class RunPathTestCase(unittest.TestCase, CodeExecutionMixin): with open(filename, 'w', encoding='latin1') as f: f.write(""" #coding:latin1 -"non-ASCII: h\xe9" +s = "non-ASCII: h\xe9" """) result = run_path(filename) - self.assertEqual(result['__doc__'], "non-ASCII: h\xe9") + self.assertEqual(result['s'], "non-ASCII: h\xe9") def test_main(): -- cgit v0.12 From 7a9953edfbbd51dbda60ab31c0e5db5eea968b53 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 12 Oct 2012 11:44:19 -0400 Subject: skip if __doc__ is gone --- Lib/test/test_timeit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_timeit.py b/Lib/test/test_timeit.py index eb3b1a1..625fb8d 100644 --- a/Lib/test/test_timeit.py +++ b/Lib/test/test_timeit.py @@ -250,6 +250,7 @@ class TestTimeit(unittest.TestCase): s = self.run_main(seconds_per_increment=60.0, switches=['-r-5']) self.assertEqual(s, "10 loops, best of 1: 60 sec per loop\n") + @unittest.skipIf(sys.flags.optimize >= 2, "need __doc__") def test_main_help(self): s = self.run_main(switches=['-h']) # Note: It's not clear that the trailing space was intended as part of -- cgit v0.12