Files
python-markdownify/tests/test_escaping.py
2022-04-13 20:04:12 +02:00

29 lines
685 B
Python

from markdownify import markdownify as md
def test_asterisks():
assert md('*hey*dude*') == r'\*hey\*dude\*'
assert md('*hey*dude*', escape_asterisks=False) == r'*hey*dude*'
def test_underscore():
assert md('_hey_dude_') == r'\_hey\_dude\_'
assert md('_hey_dude_', escape_underscores=False) == r'_hey_dude_'
def test_xml_entities():
assert md('&') == '&'
def test_named_entities():
assert md('»') == u'\xbb'
def test_hexadecimal_entities():
# This looks to be a bug in BeautifulSoup (fixed in bs4) that we have to work around.
assert md(''') == '\x27'
def test_single_escaping_entities():
assert md('&') == '&'