diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2023-02-14 13:22:19 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2023-02-14 13:22:19 -0600 |
commit | 26dabc676ac74812f2dbcfaf0e2b7c5b21e804c9 (patch) | |
tree | bbd5be35c25d171ef8999a5135a790fd7f0fd1be /tests/test_pymdvar.py | |
parent | 0e46f2cd0a2f6a972da76ec92d10bb77cd3c7f37 (diff) |
add simple tests and simple working solution
Diffstat (limited to 'tests/test_pymdvar.py')
-rw-r--r-- | tests/test_pymdvar.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_pymdvar.py b/tests/test_pymdvar.py new file mode 100644 index 0000000..2e305ec --- /dev/null +++ b/tests/test_pymdvar.py @@ -0,0 +1,32 @@ +import pytest +from markdown import markdown +from pymdvar import VariableExtension + + +def test_empty_input(): + in_str = '' + out_str = markdown(in_str, extensions=[VariableExtension()]) + print(in_str) + print(out_str) + assert in_str == out_str + + +@pytest.mark.parametrize('in_str, exp_str', [ + ('foo bar', '<p>foo bar</p>'), + ('foo *test* bar', '<p>foo <em>test</em> bar</p>'), + ('foo **test** bar', '<p>foo <strong>test</strong> bar</p>') +]) +def test_non_replacements(in_str, exp_str): + out_str = markdown(in_str, extensions=[VariableExtension()]) + assert out_str == exp_str + + +@pytest.mark.parametrize('in_str, exp_str', [ + ('foo ${test} bar', '<p>foo value bar</p>'), + ('foo *${test}* bar', '<p>foo <em>value</em> bar</p>'), + ('foo **${test}** bar', '<p>foo <strong>value</strong> bar</p>') +]) +def test_simple_replacements(in_str, exp_str): + out_str = markdown(in_str, extensions=[VariableExtension(variables={'test':'value'})]) + assert out_str == exp_str + |