Beispiel #1
0
def test_read_markdown_empty_file(tmpdir):
    src = tmpdir.join("file.txt")
    src.write("content")
    m = utils.read_markdown(str(src))
    assert 'title' not in m
    assert m['meta'] == {}
    assert m['description'] == '<p>content</p>'

    src = tmpdir.join("empty.txt")
    src.write("")
    m = utils.read_markdown(str(src))
    assert 'title' not in m
    assert 'meta' not in m
    assert m['description'] == ''
Beispiel #2
0
def test_read_markdown_empty_file(tmpdir):
    src = tmpdir.join("file.txt")
    src.write("content")
    m = utils.read_markdown(str(src))
    assert m['title'] == ''
    assert m['meta'] == {}
    assert m['description'] == '<p>content</p>'

    src = tmpdir.join("empty.txt")
    src.write("")
    m = utils.read_markdown(str(src))
    assert 'title' not in m
    assert 'meta' not in m
    assert m['description'] == ''
Beispiel #3
0
def test_read_markdown_empty_file(tmpdir):
    src = tmpdir.join("file.txt")
    src.write("content")
    m = utils.read_markdown(str(src))
    assert 'title' not in m
    assert m['meta'] == {}
    assert m['description'] == '<p>content</p>'

    src = tmpdir.join("empty.txt")
    src.write("")
    m = utils.read_markdown(str(src))
    assert 'title' not in m
    # See https://github.com/Python-Markdown/markdown/pull/672
    # Meta attributes should always be there
    assert m['meta'] == {}
    assert m['description'] == ''
Beispiel #4
0
def test_read_markdown():
    src = os.path.join(SAMPLE_DIR, 'pictures', 'dir1', 'test1', '11.md')
    m = utils.read_markdown(src)
    assert m['title'] == "Foo Bar"
    assert m['meta']['location'][0] == "Bavaria"
    assert m['description'] == \
        "<p>This is a funny description of this image</p>"
Beispiel #5
0
def test_read_markdown():
    src = os.path.join(SAMPLE_DIR, 'pictures', 'dir1', 'test1', '11.md')
    m = utils.read_markdown(src)
    assert m['title'] == "Foo Bar"
    assert m['meta']['location'][0] == "Bavaria"
    assert m['description'] == \
        "<p>This is a funny description of this image</p>"
Beispiel #6
0
def test_read_markdown_empty_file(tmpdir):
    src = tmpdir.join("file.txt")
    src.write("content")
    m = utils.read_markdown(str(src))
    assert 'title' not in m
    assert m['meta'] == {}
    assert m['description'] == '<p>content</p>'

    src = tmpdir.join("empty.txt")
    src.write("")
    m = utils.read_markdown(str(src))
    assert 'title' not in m
    # See https://github.com/Python-Markdown/markdown/pull/672
    # Meta attributes should always be there
    assert m['meta'] == {}
    assert m['description'] == ''