summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDomen Kozar <domen@dev.si>2014-03-15 11:13:33 +0100
committerDomen Kozar <domen@dev.si>2014-03-15 11:13:33 +0100
commit3d9d8b7557d58ce882fc6ab70612af077ecacb29 (patch)
tree4a0862e7f362351f0a4f8a20371ecf3227886356 /tests
parent33c8a68d402e1a929503741033690cc19eafaad1 (diff)
downloadpygments-3d9d8b7557d58ce882fc6ab70612af077ecacb29.tar.gz
get_lexer_by_name: handle edge case when _alias is None
Diffstat (limited to 'tests')
-rw-r--r--tests/test_basic_api.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py
index 18ed8d64..f2d24bab 100644
--- a/tests/test_basic_api.py
+++ b/tests/test_basic_api.py
@@ -15,7 +15,7 @@ from pygments import lexers, formatters, filters, format
from pygments.token import _TokenType, Text
from pygments.lexer import RegexLexer
from pygments.formatters.img import FontNotFound
-from pygments.util import BytesIO, StringIO, bytes, b
+from pygments.util import BytesIO, StringIO, bytes, b, ClassNotFound
import support
@@ -131,6 +131,13 @@ def test_get_lexers():
for mimetype in mimetypes:
assert cls == lexers.get_lexer_for_mimetype(mimetype).__class__.__name__
+ try:
+ lexers.get_lexer_by_name(None)
+ except ClassNotFound:
+ pass
+ else:
+ raise Exception
+
def test_formatter_public_api():
ts = list(lexers.PythonLexer().get_tokens("def f(): pass"))