diff options
author | gbrandl <devnull@localhost> | 2007-02-14 18:26:06 +0100 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2007-02-14 18:26:06 +0100 |
commit | ead01a06e3a748d49a2a487c122ab61b0f98ccb6 (patch) | |
tree | 39296fd0160aa558aa461e6dc689370dc7d16711 /tests/test_basic_api.py | |
parent | e7b3b9ecd21a2d3218c3ab66b9f213578a737890 (diff) | |
download | pygments-ead01a06e3a748d49a2a487c122ab61b0f98ccb6.tar.gz |
[svn] Add tests for filters.
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): |