Skip to content

Commit

Permalink
Add test of entry point names from IPython
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Jan 15, 2025
1 parent a0aceef commit 065b5ef
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test_ipython_pygments_lexers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.

import pygments.lexers
import pytest
from pygments import __version__ as pygments_version
from pygments.token import Token
from pygments.lexers import BashLexer
from pygments.token import Token

import ipython_pygments_lexers as lexers

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

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

EXPECTED_LEXER_NAMES = [
cls.name for cls in [lexers.IPythonConsoleLexer, lexers.IPython3Lexer]
]


@pytest.mark.parametrize("expected_lexer", EXPECTED_LEXER_NAMES)
def test_pygments_entry_points(expected_lexer: str):
"""Check whether the ``entry_points`` for ``pygments.lexers`` are correct."""
all_pygments_lexer_names = {l[0] for l in pygments.lexers.get_all_lexers()}
assert expected_lexer in all_pygments_lexer_names


def test_plain_python():
lexer = lexers.IPythonLexer()
Expand Down

0 comments on commit 065b5ef

Please sign in to comment.