mirror of https://github.com/python/cpython
Part of bug 1459808: fiddle test_input_and_raw_input()
so it passes w/ -Qnew.
This commit is contained in:
parent
1c5bc1c9d7
commit
b82cb8dcd5
|
@ -1295,8 +1295,16 @@ class BuiltinTest(unittest.TestCase):
|
||||||
'test_builtin_tmp', 'exec')
|
'test_builtin_tmp', 'exec')
|
||||||
sys.stdin.seek(0, 0)
|
sys.stdin.seek(0, 0)
|
||||||
exec compile('print input()', 'test_builtin_tmp', 'exec')
|
exec compile('print input()', 'test_builtin_tmp', 'exec')
|
||||||
self.assertEqual(sys.stdout.getvalue().splitlines(),
|
# The result we expect depends on whether new division semantics
|
||||||
['0', '0.5', '0'])
|
# 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
|
del sys.stdout
|
||||||
self.assertRaises(RuntimeError, input, 'prompt')
|
self.assertRaises(RuntimeError, input, 'prompt')
|
||||||
|
|
Loading…
Reference in New Issue