diff options
Diffstat (limited to 'tests/test_basic_api.py')
-rw-r--r-- | tests/test_basic_api.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index a5abd2b8..f07c00e7 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -7,11 +7,12 @@ :license: BSD, see LICENSE for more details. """ +import os import unittest import StringIO import random -from pygments import lexers, formatters, format +from pygments import lexers, formatters, filters, format from pygments.token import _TokenType, Text from pygments.lexer import RegexLexer @@ -70,6 +71,16 @@ class LexersTest(unittest.TestCase): a(isinstance(x, lexers.PythonLexer)) ae(x.options["opt"], "val") + def test_filters(self): + for x in filters.FILTERS.keys(): + lx = lexers.PythonLexer() + lx.add_filter(x) + text = file(os.path.join(testdir, testfile)).read().decode('utf-8') + tokens = list(lx.get_tokens(text)) + roundtext = ''.join([t[1] for t in tokens]) + self.assertEquals(roundtext, text, + "lexer roundtrip with %s filter failed" % x) + class FormattersTest(unittest.TestCase): |