Fixed tests due to html changes.

This commit is contained in:
Martin Mahner 2018-03-24 09:08:47 +01:00
parent fc0e9b8869
commit 91560b567c
2 changed files with 7 additions and 7 deletions

View file

@ -13,7 +13,7 @@ class HighlightAPITestCase(TestCase):
PLAIN_CODE is not run through Pygments, test it separately. PLAIN_CODE is not run through Pygments, test it separately.
""" """
input = 'var' input = 'var'
expected = '<span class="nn">var</span>' expected = '<span class="plain">var</span>'
value = pygmentize(input, lexer_name=PLAIN_CODE) value = pygmentize(input, lexer_name=PLAIN_CODE)
self.assertEqual(value, expected) self.assertEqual(value, expected)
@ -22,7 +22,7 @@ class HighlightAPITestCase(TestCase):
Whitespace on the first line is retained. Whitespace on the first line is retained.
""" """
input = ' var=1' input = ' var=1'
expected = '<span class="nn"> var=1</span>' expected = '<span class="plain"> var=1</span>'
value = pygmentize(input, lexer_name=PLAIN_CODE) value = pygmentize(input, lexer_name=PLAIN_CODE)
self.assertEqual(value, expected) self.assertEqual(value, expected)
@ -35,10 +35,10 @@ class HighlightAPITestCase(TestCase):
' var=3\n' ' var=3\n'
' var=4') ' var=4')
expected = ( expected = (
'<span class="nn"> var=1</span>\n' '<span class="plain"> var=1</span>\n'
'<span class="nn"> var=2</span>\n' '<span class="plain"> var=2</span>\n'
'<span class="nn"> var=3</span>\n' '<span class="plain"> var=3</span>\n'
'<span class="nn"> var=4</span>') '<span class="plain"> var=4</span>')
value = pygmentize(input, lexer_name=PLAIN_CODE) value = pygmentize(input, lexer_name=PLAIN_CODE)
self.assertEqual(value, expected) self.assertEqual(value, expected)

View file

@ -285,7 +285,7 @@ class APIView(View):
# We need at least a lexer or a filename # We need at least a lexer or a filename
if not lexer and not filename: if not lexer and not filename:
return HttpResponseBadRequest('No lexer or filename given. Unable to ' return HttpResponseBadRequest('No lexer or filename given. Unable to '
'determine a highlight. Valid lexers are: %s' % ', '.join(highlight.LEXER_LIST)) 'determine a highlight. Valid lexers are: %s' % ', '.join(highlight.LEXER_KEYS))
# A lexer is given, check if its valid at all # A lexer is given, check if its valid at all
if lexer and lexer not in highlight.LEXER_KEYS: if lexer and lexer not in highlight.LEXER_KEYS: