def test_no_lowercase_replacements_markdown(): template = os.path.join('home', 'replacements_case_error.md') md = page.get_markdown(template, {'title': 'the title', 'link': 'The link'}) text = ''' # This page imports things with data. We have a paragraph with [a link]($Link$). And this was a title: $title$ And more inline **content**. '''.strip() assert text == md.strip()
def test_basic_markdown_template(): template = os.path.join('home', 'basic_markdown.md') md = page.get_markdown(template, {'a': 1, 'b': 2}) text = ''' # This is the basic title We have a paragraph with [a link](https://talkpython.fm). * Bullet 1 * Bullet 2 * Bullet 3 '''.strip() assert text == md.strip()
def test_import_markdown(): template = os.path.join('home', 'import1.md') md = page.get_markdown(template, {'a': 1, 'b': 2}) text = ''' # This page imports one thing. We have a paragraph with [a link](https://talkpython.fm). ## This is a basic import. You'll see imported things. And more inline **content**. '''.strip() assert text == md.strip()
def test_variable_replacement_markdown(): template = os.path.join('home', 'replacements_import.md') md = page.get_markdown(template, {'Title': 'Best Title Ever!', 'link': 'https://training.talkpython.fm'}) text = ''' # This page imports things with data. We have a paragraph with [a link](https://training.talkpython.fm). ### This page had a title set: Best Title Ever! And more content with the word TITLE. And more inline **content**. '''.strip() assert text == md.strip()
def test_two_imports_markdown(): template = os.path.join('home', 'two_imports.md') md = page.get_markdown(template, {}) text = ''' # This page imports nested things. We have a paragraph with [a link](https://talkpython.fm). ## This is a basic import. You'll see imported things. ## This is the second import. You'll see imported things. And more inline **content**. '''.strip() assert text == md.strip()
def test_missing_import_markdown(): template = os.path.join('home', 'import_missing.md') with pytest.raises(exceptions.TemplateNotFoundException): page.get_markdown(template, {'a': 1, 'b': 2})