diff options
-rw-r--r-- | tests/test_basic_api.py | 6 | ||||
-rw-r--r-- | tests/test_cmdline.py | 4 | ||||
-rw-r--r-- | tests/test_examplefiles.py | 2 | ||||
-rw-r--r-- | tests/test_html_formatter.py | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 4126279c..429e0823 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -94,7 +94,7 @@ class FiltersTest(unittest.TestCase): for x in filters.FILTERS.keys(): lx = lexers.PythonLexer() lx.add_filter(x, **filter_args.get(x, {})) - text = file(TESTFILE).read().decode('utf-8') + text = open(TESTFILE).read().decode('utf-8') tokens = list(lx.get_tokens(text)) roundtext = ''.join([t[1] for t in tokens]) if x not in ('whitespace', 'keywordcase'): @@ -110,14 +110,14 @@ class FiltersTest(unittest.TestCase): def test_whitespace(self): lx = lexers.PythonLexer() lx.add_filter('whitespace', spaces='%') - text = file(TESTFILE).read().decode('utf-8') + text = open(TESTFILE).read().decode('utf-8') lxtext = ''.join([t[1] for t in list(lx.get_tokens(text))]) self.failIf(' ' in lxtext) def test_keywordcase(self): lx = lexers.PythonLexer() lx.add_filter('keywordcase', case='capitalize') - text = file(TESTFILE).read().decode('utf-8') + text = open(TESTFILE).read().decode('utf-8') lxtext = ''.join([t[1] for t in list(lx.get_tokens(text))]) self.assert_('Def' in lxtext and 'Class' in lxtext) diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index eaf1cbfc..68b2d7b7 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -3,7 +3,7 @@ Command line test ~~~~~~~~~~~~~~~~~ - :copyright: 2006-2007 by Georg Brandl. + :copyright: 2006-2008 by Georg Brandl. :license: BSD, see LICENSE for more details. """ @@ -87,7 +87,7 @@ class CmdLineTest(unittest.TestCase): from pygments.lexers import PythonLexer from pygments.formatters import HtmlFormatter filename = TESTFILE - code = file(filename).read() + code = open(filename).read() output = highlight(code, PythonLexer(), HtmlFormatter()) diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py index 57d17033..baf6978a 100644 --- a/tests/test_examplefiles.py +++ b/tests/test_examplefiles.py @@ -40,7 +40,7 @@ def test_example_files(): yield check_lexer, lx, absfn def check_lexer(lx, absfn): - text = file(absfn, 'U').read() + text = open(absfn, 'U').read() text = text.strip('\n') + '\n' try: text = text.decode('utf-8') diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index 9c9792c3..dc7285ad 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -22,7 +22,7 @@ import support TESTFILE, TESTDIR = support.location(__file__) -tokensource = list(PythonLexer(encoding='utf-8').get_tokens(file(TESTFILE).read())) +tokensource = list(PythonLexer(encoding='utf-8').get_tokens(open(TESTFILE).read())) class HtmlFormatterTest(unittest.TestCase): def test_correct_output(self): |