1from paste.util import quoting 2import six 3import unittest 4 5class TestQuoting(unittest.TestCase): 6 def test_html_unquote(self): 7 self.assertEqual(quoting.html_unquote(b'<hey you>'), 8 u'<hey\xa0you>') 9 self.assertEqual(quoting.html_unquote(b''), 10 u'') 11 self.assertEqual(quoting.html_unquote(b'&blahblah;'), 12 u'&blahblah;') 13 self.assertEqual(quoting.html_unquote(b'\xe1\x80\xa9'), 14 u'\u1029') 15 16 def test_html_quote(self): 17 self.assertEqual(quoting.html_quote(1), 18 '1') 19 self.assertEqual(quoting.html_quote(None), 20 '') 21 self.assertEqual(quoting.html_quote('<hey!>'), 22 '<hey!>') 23 if six.PY3: 24 self.assertEqual(quoting.html_quote(u'<\u1029>'), 25 u'<\u1029>') 26 else: 27 self.assertEqual(quoting.html_quote(u'<\u1029>'), 28 '<\xe1\x80\xa9>') 29