jinja2-highlight icon indicating copy to clipboard operation
jinja2-highlight copied to clipboard

Tests failing due to Pygments lexer guessing

Open joequery opened this issue 9 years ago • 0 comments

The test_python_tpl_with_table_no_lang test (Source here) is failing because Pygment's guess_lexer doesn't seem to catch extremely basic Python. Environment info:

  • Python version - 2.7.6
  • Pygments version - 2.0.2

Demo:

>>> from pygments.lexers import guess_lexer
>>> # PHP is okay
>>> guess_lexer("<?php echo $x; ?>")
<pygments.lexers.JavascriptPhpLexer>
>>> # Specific python examples are okay
>>> guess_lexer("from a.b import c")
<pygments.lexers.PythonLexer>
>>> # Trivial python examples (such as in the tests), not so much
>>> guess_lexer("print 'Hello world'")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vagrant/.envs/joequery/local/lib/python2.7/site-packages/pygments/lexers/__init__.py", line 252, in guess_lexer
    raise ClassNotFound('no lexer matching the text found')
pygments.util.ClassNotFound: no lexer matching the text found

test_python_tpl_with_inline_no_lang is naturally failing as well.

joequery avatar Nov 07 '15 22:11 joequery