[Python-checkins] r61590 - python/trunk/Lib/test/test_compiler.py
eric.smith
python-checkins at python.org
Wed Mar 19 04:13:35 CET 2008
Author: eric.smith
Date: Wed Mar 19 04:13:34 2008
New Revision: 61590
Modified:
python/trunk/Lib/test/test_compiler.py
Log:
Another test for __future__ print_function.
Modified: python/trunk/Lib/test/test_compiler.py
==============================================================================
--- python/trunk/Lib/test/test_compiler.py (original)
+++ python/trunk/Lib/test/test_compiler.py Wed Mar 19 04:13:34 2008
@@ -3,6 +3,7 @@
import os, sys, time, unittest
import test.test_support
from random import random
+from StringIO import StringIO
# How much time in seconds can pass before we print a 'Still working' message.
_PRINT_WORKING_MSG_INTERVAL = 5 * 60
@@ -156,6 +157,16 @@
self.assertEquals(dct.get('result'), 1)
+ def testPrintFunction(self):
+ c = compiler.compile('from __future__ import print_function\n'
+ 'print("a", "b", sep="**", end="++", '
+ 'file=output)',
+ '<string>',
+ 'exec' )
+ dct = {'output': StringIO()}
+ exec c in dct
+ self.assertEquals(dct['output'].getvalue(), 'a**b++')
+
def _testErrEnc(self, src, text, offset):
try:
compile(src, "", "exec")
More information about the Python-checkins
mailing list