1 from typing import List 2 3 import pytest 4 import pygments.lexers 5 import pygments.lexer 6 7 from IPython.lib.lexers import IPythonConsoleLexer, IPythonLexer, IPython3Lexer 8 9 #: the human-readable names of the IPython lexers with ``entry_points`` 10 EXPECTED_LEXER_NAMES = [ 11 cls.name for cls in [IPythonConsoleLexer, IPythonLexer, IPython3Lexer] 12 ] 13 14 15 @pytest.fixture 16 def all_pygments_lexer_names() -> List[str]: 17 """Get all lexer names registered in pygments.""" 18 return {l[0] for l in pygments.lexers.get_all_lexers()} 19 20 21 @pytest.mark.parametrize("expected_lexer", EXPECTED_LEXER_NAMES) 22 def test_pygments_entry_points( 23 expected_lexer: str, all_pygments_lexer_names: List[str] 24 ) -> None: 25 """Check whether the ``entry_points`` for ``pygments.lexers`` are correct.""" 26 assert expected_lexer in all_pygments_lexer_names 27