diff options
| author | Eric Smith <eric@trueblade.com> | 2008-03-19 03:13:34 (GMT) |
|---|---|---|
| committer | Eric Smith <eric@trueblade.com> | 2008-03-19 03:13:34 (GMT) |
| commit | 14cae96fa686cbddfd1df8dde8af22d6c6cda956 (patch) | |
| tree | ae0e1a3c91a79fe4a617279cc672b675e532c997 /Lib/test/test_compiler.py | |
| parent | 2724ab99c8c81cdb032372871d8f1eebb171ebe7 (diff) | |
| download | cpython-14cae96fa686cbddfd1df8dde8af22d6c6cda956.zip cpython-14cae96fa686cbddfd1df8dde8af22d6c6cda956.tar.gz cpython-14cae96fa686cbddfd1df8dde8af22d6c6cda956.tar.bz2 | |
Another test for __future__ print_function.
Diffstat (limited to 'Lib/test/test_compiler.py')
| -rw-r--r-- | Lib/test/test_compiler.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py index 7d5ec7c..d491b78 100644 --- a/Lib/test/test_compiler.py +++ b/Lib/test/test_compiler.py @@ -3,6 +3,7 @@ from compiler.ast import flatten 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 @@ class CompilerTest(unittest.TestCase): 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") |
