From ae5c5fdb18fa618e84c408264f596ebdec96e5df Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 18 Sep 2008 21:03:16 -0500 Subject: remove __builtin__.testdir/testfile magic This adds a new file tests/support.py --- tests/test_basic_api.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/test_basic_api.py') diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 760dda63..371e7ec3 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -17,6 +17,8 @@ from pygments.token import _TokenType, Text from pygments.lexer import RegexLexer from pygments.formatters.img import FontNotFound +from support import test_file + test_content = [chr(i) for i in xrange(33, 128)] * 5 random.shuffle(test_content) test_content = ''.join(test_content) + '\n' @@ -90,7 +92,7 @@ class FiltersTest(unittest.TestCase): for x in filters.FILTERS.keys(): lx = lexers.PythonLexer() lx.add_filter(x, **filter_args.get(x, {})) - text = file(os.path.join(testdir, testfile)).read().decode('utf-8') + text = file(test_file()).read().decode('utf-8') tokens = list(lx.get_tokens(text)) roundtext = ''.join([t[1] for t in tokens]) if x not in ('whitespace', 'keywordcase'): @@ -106,14 +108,14 @@ class FiltersTest(unittest.TestCase): def test_whitespace(self): lx = lexers.PythonLexer() lx.add_filter('whitespace', spaces='%') - text = file(os.path.join(testdir, testfile)).read().decode('utf-8') + text = file(test_file()).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(os.path.join(testdir, testfile)).read().decode('utf-8') + text = file(test_file()).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) -- cgit v1.2.1