[Python-checkins] python/dist/src/Lib/test test_builtin.py, 1.27,
1.28
perky at projects.sourceforge.net
perky at projects.sourceforge.net
Mon Feb 2 08:39:04 EST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18238/Lib/test
Modified Files:
test_builtin.py
Log Message:
Fix input() builtin function to respect compiler flags.
(SF patch 876178, patch by mwh, unittest by perky)
Index: test_builtin.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** test_builtin.py 17 Dec 2003 20:43:32 -0000 1.27
--- test_builtin.py 2 Feb 2004 13:39:01 -0000 1.28
***************
*** 932,935 ****
--- 932,948 ----
sys.stdin = cStringIO.StringIO()
self.assertRaises(EOFError, input)
+
+ # SF 876178: make sure input() respect future options.
+ sys.stdin = cStringIO.StringIO('1/2')
+ sys.stdout = cStringIO.StringIO()
+ exec compile('print input()', 'test_builtin_tmp', 'exec')
+ sys.stdin.seek(0, 0)
+ exec compile('from __future__ import division;print input()',
+ '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'])
+
del sys.stdout
self.assertRaises(RuntimeError, input, 'prompt')
More information about the Python-checkins
mailing list