summaryrefslogtreecommitdiffstats
path: root/tests/core/test_html.py
blob: 012a0ce49cb526ab33ac6123f8857b7a50127cdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from core.html import html_to_plaintext


def test_html_to_plaintext():

    assert html_to_plaintext("<p>Hi!</p>") == "Hi!"
    assert html_to_plaintext("<p>Hi!<br>There</p>") == "Hi!\nThere"
    assert (
        html_to_plaintext("<p>Hi!</p>\n\n<p>How are you?</p>") == "Hi!\n\nHow are you?"
    )

    assert (
        html_to_plaintext("<p>Hi!</p>\n\n<p>How are<br> you?</p><p>today</p>")
        == "Hi!\n\nHow are\n you?\n\ntoday"
    )