예제 #1
0
 def testHexUnescape(self):
     text = "'hello world'! This is a "test"."
     expect = """'hello world'! This is a "test"."""
     self.assertEqual(html.unescape(text), expect)
예제 #2
0
 def testHexEscape(self):
     text = """
     'hello world'! This is a "test".
     """
     self.assertEqual(html.unescape(html.hex_escape(text)), text)
예제 #3
0
 def testDecimalEscape(self):
     text = """
     'hello world'! This is a "test".
     """
     self.assertEqual(html.unescape(html.decimal_escape(text)), text)
예제 #4
0
 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)
예제 #5
0
 def testHexUnescape(self):
     text = "'hello world'! This is a "test"."
     expect = """'hello world'! This is a "test"."""
     self.assertEqual(html.unescape(text), expect)
예제 #6
0
 def testDecimalEscape(self):
     text = """
     'hello world'! This is a "test".
     """
     self.assertEqual(html.unescape(html.decimal_escape(text)), text)
예제 #7
0
 def testHexEscape(self):
     text = """
     'hello world'! This is a "test".
     """
     self.assertEqual(html.unescape(html.hex_escape(text)), text)
예제 #8
0
 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)