Skip to content

Commit 065b5ef

Browse files
committed
Add test of entry point names from IPython
1 parent a0aceef commit 065b5ef

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test_ipython_pygments_lexers.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,29 @@
33
# Copyright (c) IPython Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6+
import pygments.lexers
7+
import pytest
68
from pygments import __version__ as pygments_version
7-
from pygments.token import Token
89
from pygments.lexers import BashLexer
10+
from pygments.token import Token
911

1012
import ipython_pygments_lexers as lexers
1113

1214
pyg214 = tuple(int(x) for x in pygments_version.split(".")[:2]) >= (2, 14)
1315

1416
TOKEN_WS = Token.Text.Whitespace if pyg214 else Token.Text
1517

18+
EXPECTED_LEXER_NAMES = [
19+
cls.name for cls in [lexers.IPythonConsoleLexer, lexers.IPython3Lexer]
20+
]
21+
22+
23+
@pytest.mark.parametrize("expected_lexer", EXPECTED_LEXER_NAMES)
24+
def test_pygments_entry_points(expected_lexer: str):
25+
"""Check whether the ``entry_points`` for ``pygments.lexers`` are correct."""
26+
all_pygments_lexer_names = {l[0] for l in pygments.lexers.get_all_lexers()}
27+
assert expected_lexer in all_pygments_lexer_names
28+
1629

1730
def test_plain_python():
1831
lexer = lexers.IPythonLexer()

0 commit comments

Comments
 (0)