diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run.py | 9 | ||||
-rw-r--r-- | tests/test_basic_api.py | 3 | ||||
-rw-r--r-- | tests/test_examplefiles.py | 11 | ||||
-rw-r--r-- | tests/test_html_formatter.py | 3 | ||||
-rw-r--r-- | tests/test_latex_formatter.py | 3 |
5 files changed, 17 insertions, 12 deletions
diff --git a/tests/run.py b/tests/run.py index 6c22fdc8..f035fd56 100644 --- a/tests/run.py +++ b/tests/run.py @@ -11,6 +11,7 @@ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import print_function import sys, os @@ -40,14 +41,14 @@ try: sys.path.insert(0, '..') import pygments except SyntaxError: - print ('Syntax error: %s' % sys.exc_info()[1]) + print(('Syntax error: %s' % sys.exc_info()[1])) print ('Please run setup.py build before make test on Python 3') sys.exit(1) except ImportError: - print ('Cannot find Pygments to test: %s' % sys.exc_info()[1]) + print(('Cannot find Pygments to test: %s' % sys.exc_info()[1])) sys.exit(1) else: - print ('Pygments %s test suite running (Python %s)...' % - (pygments.__version__, sys.version.split()[0])) + print(('Pygments %s test suite running (Python %s)...' % + (pygments.__version__, sys.version.split()[0]))) nose.main() diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 1c6933a7..ecf45d84 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -6,6 +6,7 @@ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import print_function import os import random @@ -71,7 +72,7 @@ def test_lexer_classes(): assert isinstance(token, tuple) assert isinstance(token[0], _TokenType) if isinstance(token[1], str): - print repr(token[1]) + print(repr(token[1])) assert isinstance(token[1], unicode) txt += token[1] assert txt == test_content, "%s lexer roundtrip failed: %r != %r" % \ diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py index 79b854ad..469066da 100644 --- a/tests/test_examplefiles.py +++ b/tests/test_examplefiles.py @@ -6,6 +6,7 @@ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import print_function import os import pprint @@ -32,7 +33,7 @@ def test_example_files(): if not os.path.isfile(absfn): continue - print absfn + print(absfn) code = open(absfn, 'rb').read() try: code = code.decode('utf-8') @@ -80,8 +81,8 @@ def check_lexer(lx, absfn, outfn): (lx, absfn, val, len(u''.join(ntext))) tokens.append((type, val)) if u''.join(ntext) != text: - print '\n'.join(difflib.unified_diff(u''.join(ntext).splitlines(), - text.splitlines())) + print('\n'.join(difflib.unified_diff(u''.join(ntext).splitlines(), + text.splitlines()))) raise AssertionError('round trip failed for ' + absfn) # check output against previous run if enabled @@ -103,6 +104,6 @@ def check_lexer(lx, absfn, outfn): if stored_tokens != tokens: f1 = pprint.pformat(stored_tokens) f2 = pprint.pformat(tokens) - print '\n'.join(difflib.unified_diff(f1.splitlines(), - f2.splitlines())) + print('\n'.join(difflib.unified_diff(f1.splitlines(), + f2.splitlines()))) assert False, absfn diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index 5dd2e127..c24d63b9 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -6,6 +6,7 @@ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import print_function import os import re @@ -132,7 +133,7 @@ class HtmlFormatterTest(unittest.TestCase): pass else: if ret: - print output + print(output) self.assertFalse(ret, 'nsgmls run reported errors') os.unlink(pathname) diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py index 1156cc51..6a752827 100644 --- a/tests/test_latex_formatter.py +++ b/tests/test_latex_formatter.py @@ -6,6 +6,7 @@ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import print_function import os import unittest @@ -48,7 +49,7 @@ class LatexFormatterTest(unittest.TestCase): pass else: if ret: - print output + print(output) self.assertFalse(ret, 'latex run reported errors') os.unlink(pathname) |