diff options
Diffstat (limited to 'tests/test_latex_formatter.py')
-rw-r--r-- | tests/test_latex_formatter.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py index 06a74c3d..56b5db2e 100644 --- a/tests/test_latex_formatter.py +++ b/tests/test_latex_formatter.py @@ -3,10 +3,12 @@ Pygments LaTeX formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import print_function + import os import unittest import tempfile @@ -22,11 +24,8 @@ TESTFILE, TESTDIR = support.location(__file__) class LatexFormatterTest(unittest.TestCase): def test_valid_output(self): - fp = open(TESTFILE) - try: + with open(TESTFILE) as fp: tokensource = list(PythonLexer().get_tokens(fp.read())) - finally: - fp.close() fmt = LatexFormatter(full=True, encoding='latin1') handle, pathname = tempfile.mkstemp('.tex') @@ -48,7 +47,7 @@ class LatexFormatterTest(unittest.TestCase): pass else: if ret: - print output + print(output) self.assertFalse(ret, 'latex run reported errors') os.unlink(pathname) |