diff options
author | gbrandl <devnull@localhost> | 2008-07-05 18:30:53 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2008-07-05 18:30:53 +0200 |
commit | aa6ca11bdccf9429558240247a75b5ac559a63ca (patch) | |
tree | 34aafb303e60d9b7c8824d29b627d541a0833569 /tests/test_examplefiles.py | |
parent | 610fb310f3341090f85f941c732fa3ccd377a69e (diff) | |
download | pygments-aa6ca11bdccf9429558240247a75b5ac559a63ca.tar.gz |
Use specific exception.
Diffstat (limited to 'tests/test_examplefiles.py')
-rw-r--r-- | tests/test_examplefiles.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py index ee9c78af..ee9af608 100644 --- a/tests/test_examplefiles.py +++ b/tests/test_examplefiles.py @@ -3,7 +3,7 @@ Pygments tests with example files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: 2006-2007 by Georg Brandl. + :copyright: 2006-2008 by Georg Brandl. :license: BSD, see LICENSE for more details. """ @@ -13,6 +13,7 @@ import unittest from pygments import highlight from pygments.lexers import get_lexer_for_filename, get_lexer_by_name from pygments.token import Error +from pygments.util import ClassNotFound class ExampleFileTest(unittest.TestCase): @@ -28,11 +29,11 @@ for fn in os.listdir(os.path.join(testdir, 'examplefiles')): try: lx = get_lexer_for_filename(absfn) - except ValueError: + except ClassNotFound: try: name, rest = fn.split("_", 1) lx = get_lexer_by_name(name) - except ValueError: + except ClassNotFound: raise AssertionError('no lexer found for file %r' % fn) def test(self, lx=lx, absfn=absfn): |