Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
added test_escape_markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
rockygo2 committed Jun 13, 2024
1 parent 1a5311c commit 24b0b85
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,12 @@ def test_string_width():

for string, expected_width in test_cases:
assert utils._string_width(string) == expected_width


def test_escape_markdown():
assert utils.escape_markdown("") == ""
assert utils.escape_markdown("*hello*") == "\\*hello\\*"
assert utils.escape_markdown("**hello**") == "\\*\\*hello\\*\\*"
assert utils.escape_markdown("**hello**", as_needed=True) == "\\*\\*hello**"
assert utils.escape_markdown("**hello** world", as_needed=True) == "\\*\\*hello** world"
assert utils.escape_markdown("Visit https://example.com Please") == "Visit https://example.com Please"
assert utils.escape_markdown("[link](https://example.com)", ignore_links=False) == "\\[link](https://example.com)"

0 comments on commit 24b0b85

Please sign in to comment.