def testHexUnescape(self): text = "'hello world'! This is a "test"." expect = """'hello world'! This is a "test".""" self.assertEqual(html.unescape(text), expect)
def testHexEscape(self): text = """ 'hello world'! This is a "test". """ self.assertEqual(html.unescape(html.hex_escape(text)), text)
def testDecimalEscape(self): text = """ 'hello world'! This is a "test". """ self.assertEqual(html.unescape(html.decimal_escape(text)), text)
def testDecimalUnescape(self): text = ''.join('&#{};'.format(ord(c)) for c in """'hello world'! This is a "test".""") expect = """'hello world'! This is a "test".""" self.assertEqual(html.unescape(text), expect)
def testHexUnescape(self): text = "'hello world'! This is a "test"." expect = """'hello world'! This is a "test".""" self.assertEqual(html.unescape(text), expect)
def testDecimalEscape(self): text = """ 'hello world'! This is a "test". """ self.assertEqual(html.unescape(html.decimal_escape(text)), text)
def testHexEscape(self): text = """ 'hello world'! This is a "test". """ self.assertEqual(html.unescape(html.hex_escape(text)), text)
def testDecimalUnescape(self): text = "".join("&#{};".format(ord(c)) for c in """'hello world'! This is a "test".""") expect = """'hello world'! This is a "test".""" self.assertEqual(html.unescape(text), expect)