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_tasklists.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/test_tasklists.py (limited to 'tests/test_tasklists.py') diff --git a/tests/test_tasklists.py b/tests/test_tasklists.py new file mode 100644 index 0000000..427c336 --- /dev/null +++ b/tests/test_tasklists.py @@ -0,0 +1,34 @@ +from pathlib import Path +from textwrap import dedent + +from markdown_it import MarkdownIt +from markdown_it.utils import read_fixture_file +import pytest + +from mdit_py_plugins.tasklists import tasklists_plugin + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures", "tasklists.md") + + +def test_plugin_parse(data_regression): + md = MarkdownIt().use(tasklists_plugin) + tokens = md.parse( + dedent( + """\ + * [ ] Task incomplete + * [x] Task complete + * [ ] Indented task incomplete + * [x] Indented task complete + """ + ) + ) + data_regression.check([t.as_dict() for t in tokens]) + + +@pytest.mark.parametrize("line,title,input,expected", read_fixture_file(FIXTURE_PATH)) +def test_all(line, title, input, expected): + md = MarkdownIt("commonmark").use(tasklists_plugin) + md.options["xhtmlOut"] = False + text = md.render(input) + print(text) + assert text.rstrip() == expected.rstrip() -- cgit v1.2.3