diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-04-22 03:37:20 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-04-22 03:37:20 +0200 |
commit | 71f6019052c1c38757e474ba2f5160e4d7eb3cb8 (patch) | |
tree | 2f5cf8da68e1222998285300b1bad4d8d8027994 /tests/test_util | |
parent | e1b6b53506a59aea9540f8906c666beb563ff3eb (diff) | |
download | paste-git-71f6019052c1c38757e474ba2f5160e4d7eb3cb8.tar.gz |
Fix paste.util.html_quote(unicode): don't encode the string to escape it
Diffstat (limited to 'tests/test_util')
-rw-r--r-- | tests/test_util/test_quoting.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_util/test_quoting.py b/tests/test_util/test_quoting.py new file mode 100644 index 0000000..28790a4 --- /dev/null +++ b/tests/test_util/test_quoting.py @@ -0,0 +1,24 @@ +from paste.util import quoting +import six +import unittest + +class TestQuoting(unittest.TestCase): + def test_html_unquote(self): + self.assertEqual(quoting.html_unquote(b'<hey you>'), + u'<hey\xa0you>') + self.assertEqual(quoting.html_unquote(b''), + u'') + self.assertEqual(quoting.html_unquote(b'&blahblah;'), + u'&blahblah;') + self.assertEqual(quoting.html_unquote(b'\xe1\x80\xa9'), + u'\u1029') + + def test_html_quote(self): + self.assertEqual(quoting.html_quote(1), + '1') + self.assertEqual(quoting.html_quote(None), + '') + self.assertEqual(quoting.html_quote('<hey!>'), + '<hey!>') + self.assertEqual(quoting.html_quote(u'<\u1029>'), + u'<\u1029>') |