import pytest from markdown import markdown from pymdvar import VariableExtension def test_empty_input(): in_str: str = '' out_str: str = markdown(in_str, extensions=[VariableExtension()]) assert in_str == out_str @pytest.mark.parametrize('in_str, exp_str', [ ('foo bar', '

foo bar

'), ('foo *test* bar', '

foo test bar

'), ('foo **test** bar', '

foo test bar

'), ('foo $test bar', '

foo $test bar

'), ('foo *${test* bar', '

foo ${test bar

'), ('foo **$test}** bar', '

foo $test} bar

'), ]) def test_non_replacements(in_str, exp_str): out_str: str = markdown(in_str, extensions=[VariableExtension()]) assert out_str == exp_str @pytest.mark.parametrize('in_str, exp_str', [ ('foo ${test} bar', '

foo value bar

'), ('foo *${test}* bar', '

foo value bar

'), ('foo **${test}** bar', '

foo value bar

'), ('foo [link](${test}/a.html) bar', '

foo link bar

'), ('foo ![image](${test}/a.jpg) bar', '

foo image bar

'), ]) def test_simple_replacements(in_str, exp_str): out_str: str = markdown(in_str, extensions=[VariableExtension(variables={'test':'value'})]) assert out_str == exp_str