From fcb2f10732db61d216e2105c8154486f66b3e3ff Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:29:52 +0200 Subject: Adding upstream version 0.3.3. Signed-off-by: Daniel Baumann --- tests/test_substitution.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/test_substitution.py (limited to 'tests/test_substitution.py') diff --git a/tests/test_substitution.py b/tests/test_substitution.py new file mode 100644 index 0000000..706c1e2 --- /dev/null +++ b/tests/test_substitution.py @@ -0,0 +1,33 @@ +from pathlib import Path +from textwrap import dedent + +from markdown_it import MarkdownIt +from markdown_it.utils import read_fixture_file +import pytest + +# from markdown_it.token import Token +from mdit_py_plugins.substitution import substitution_plugin + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures", "substitution.md") + + +@pytest.mark.parametrize("line,title,input,expected", read_fixture_file(FIXTURE_PATH)) +def test_fixtures(line, title, input, expected): + md = MarkdownIt("commonmark").enable("table").use(substitution_plugin) + text = md.render(input) + print(text) + assert text.rstrip() == expected.rstrip() + + +def test_tokens(data_regression): + md = MarkdownIt().use(substitution_plugin) + tokens = md.parse( + dedent( + """\ + {{ block }} + + a {{ inline }} b + """ + ) + ) + data_regression.check([t.as_dict() for t in tokens]) -- cgit v1.2.3