diff options
author | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/python/MarkupSafe/py2/tests/test_escape.py |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/python/MarkupSafe/py2/tests/test_escape.py')
-rw-r--r-- | contrib/python/MarkupSafe/py2/tests/test_escape.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/python/MarkupSafe/py2/tests/test_escape.py b/contrib/python/MarkupSafe/py2/tests/test_escape.py new file mode 100644 index 00000000000..788134aeaa4 --- /dev/null +++ b/contrib/python/MarkupSafe/py2/tests/test_escape.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +import pytest + +from markupsafe import Markup + + + ("value", "expect"), + ( + # empty + (u"", u""), + # ascii + (u"abcd&><'\"efgh", u"abcd&><'"efgh"), + (u"&><'\"efgh", u"&><'"efgh"), + (u"abcd&><'\"", u"abcd&><'""), + # 2 byte + (u"こんにちは&><'\"こんばんは", u"こんにちは&><'"こんばんは"), + (u"&><'\"こんばんは", u"&><'"こんばんは"), + (u"こんにちは&><'\"", u"こんにちは&><'""), + # 4 byte + ( + u"\U0001F363\U0001F362&><'\"\U0001F37A xyz", + u"\U0001F363\U0001F362&><'"\U0001F37A xyz", + ), + (u"&><'\"\U0001F37A xyz", u"&><'"\U0001F37A xyz"), + (u"\U0001F363\U0001F362&><'\"", u"\U0001F363\U0001F362&><'""), + ), +) +def test_escape(escape, value, expect): + assert escape(value) == Markup(expect) |