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 | b19f4f27189a29d3a1c4cf036ae51d35db83ea5a (patch) | |
tree | 2f5cf8da68e1222998285300b1bad4d8d8027994 /tests | |
parent | aadcd3e4f4ac5c8251db1a7899d96c8ee279e04d (diff) | |
download | paste-b19f4f27189a29d3a1c4cf036ae51d35db83ea5a.tar.gz |
Fix paste.util.html_quote(unicode): don't encode the string to escape it
Diffstat (limited to 'tests')
-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>') |