From b82cb8dcd513d49dc674f6973c984628c14cf045 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Tue, 28 Mar 2006 07:39:22 +0000 Subject: [PATCH] Part of bug 1459808: fiddle test_input_and_raw_input() so it passes w/ -Qnew. --- Lib/test/test_builtin.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 7fdc063f1f..a05babf288 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1295,8 +1295,16 @@ class BuiltinTest(unittest.TestCase): 'test_builtin_tmp', 'exec') sys.stdin.seek(0, 0) exec compile('print input()', 'test_builtin_tmp', 'exec') - self.assertEqual(sys.stdout.getvalue().splitlines(), - ['0', '0.5', '0']) + # The result we expect depends on whether new division semantics + # are already in effect. + if 1/2 == 0: + # This test was compiled with old semantics. + expected = ['0', '0.5', '0'] + else: + # This test was compiled with new semantics (e.g., -Qnew + # was given on the command line. + expected = ['0.5', '0.5', '0.5'] + self.assertEqual(sys.stdout.getvalue().splitlines(), expected) del sys.stdout self.assertRaises(RuntimeError, input, 'prompt') -- 2.50.1