diff options
| author | Benjamin Peterson <Benjamin Peterson@localhost> | 2008-09-21 19:25:33 -0500 |
|---|---|---|
| committer | Benjamin Peterson <Benjamin Peterson@localhost> | 2008-09-21 19:25:33 -0500 |
| commit | 1d949984106130e91f234b7bf7d57774ca6c71f3 (patch) | |
| tree | 037706aba7001e959421041569e7b5f1c79fe07c /tests/test_basic_api.py | |
| parent | 486c574841ab41b7b76d14b9b861aa4888399f12 (diff) | |
| download | pygments-git-1d949984106130e91f234b7bf7d57774ca6c71f3.tar.gz | |
instead of picking a random modules to test, provide an easy way to get the current one
Diffstat (limited to 'tests/test_basic_api.py')
| -rw-r--r-- | tests/test_basic_api.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 371e7ec3..1168c7ad 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -17,7 +17,9 @@ from pygments.token import _TokenType, Text from pygments.lexer import RegexLexer from pygments.formatters.img import FontNotFound -from support import test_file +import support + +TESTFILE, TESTDIR = support.location(__file__) test_content = [chr(i) for i in xrange(33, 128)] * 5 random.shuffle(test_content) @@ -92,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(test_file()).read().decode('utf-8') + text = file(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'): @@ -108,14 +110,14 @@ class FiltersTest(unittest.TestCase): def test_whitespace(self): lx = lexers.PythonLexer() lx.add_filter('whitespace', spaces='%') - text = file(test_file()).read().decode('utf-8') + text = file(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(test_file()).read().decode('utf-8') + text = file(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) |
