from discord_rss_bot.markdown import convert_html_to_md def test_convert_to_md(): # Test bold assert convert_html_to_md("bold") == "**bold**" # Test italic assert convert_html_to_md("italic") == "*italic*" # Test blockquote assert convert_html_to_md("
blockquote
") == ">>> blockquote" # Test code assert convert_html_to_md("code") == "`code`" # Test strikethrough assert convert_html_to_md("strikethrough") == "~~strikethrough~~" # Test link assert convert_html_to_md('link') == "[link](https://example.com)" # Test pre code assert convert_html_to_md("
pre code
") == "``pre code``" # Test strong assert convert_html_to_md("strong") == "**strong**" # Test multiple tags assert ( convert_html_to_md( 'bold italic link code strikethrough' ) == "**bold** *italic* [link](https://example.com) `code` ~~strikethrough~~" ) # Test removing all other tags assert convert_html_to_md("

paragraph

") == "paragraph" assert convert_html_to_md("

paragraph

paragraph

") == "paragraphparagraph" # Test
tags assert ( convert_html_to_md("

paragraph
paragraph

") == """paragraph paragraph""" ) # Test removing trailing newline assert convert_html_to_md("paragraph ") == "paragraph" # Test removing leading and trailing whitespace assert convert_html_to_md(" paragraph ") == "paragraph" # Test removing leading and trailing whitespace and trailing newline assert ( convert_html_to_md( """ paragraph """ # noqa: W293 ) == "paragraph" )