Пример #1
0
def test_umarkdown_with_smart():
    assert "<p>Hello---</p>\n" == markdown("Hello---")
    assert "<p>Hello—</p>\n" == markdown("Hello---", smart=True)
Пример #2
0
def test_umarkdown_with_text():
    with pytest.raises(TypeError):
        markdown()
    with pytest.raises(TypeError):
        markdown(text_file="not_exists.md")
    assert "<h1>Hello World</h1>\n" == markdown(text="# Hello World")
Пример #3
0
def test_umarkdown_with_no_breaks():
    assert "<p>Hello,\nWorld!</p>\n" == markdown("Hello,\nWorld!")
    assert "<p>Hello, World!</p>\n" == markdown("Hello,\nWorld!",
                                                no_breaks=True)
Пример #4
0
def test_umarkdown_with_unsafe():
    assert "<!-- raw HTML omitted -->\n" == markdown("<p>Hello World!</p>")
    assert "<p>Hello World!</p>\n" == markdown("<p>Hello World!</p>",
                                               unsafe=True)
Пример #5
0
def test_umarkdown_with_hard_breaks():
    assert "<p>Hello,\nWorld!</p>\n" == markdown("Hello,\nWorld!")
    assert "<p>Hello,<br />\nWorld!</p>\n" == markdown("Hello,\nWorld!",
                                                       hard_breaks=True)
Пример #6
0
def test_umarkdown_with_source_pos():
    assert '<h1 data-sourcepos="1:1-1:13">Hello World</h1>\n' == markdown(
        "# Hello World", source_pos=True)
Пример #7
0
def test_umarkdown_with_text_file_and_output_file():
    with open("hello.md", "w") as f:
        f.write("# Hello World")
    assert markdown(text_file="hello.md", output_file="hello.html")
    assert "<h1>Hello World</h1>\n" == Path("hello.html").read_text()
Пример #8
0
def test_umarkdown_with_output_file():
    markdown("# Hello World", output_file="hello.html")
    assert "<h1>Hello World</h1>\n" == Path("hello.html").read_text()
Пример #9
0
def test_umarkdown_with_text_file():
    with open("hello.md", "w") as f:
        f.write("# Hello World")
    assert "<h1>Hello World</h1>\n" == markdown(text_file="hello.md")