def test_unicode_escape(self): self.assertEqual(escape('ъ'), 'ÑŠ') # http://en.wikipedia.org/wiki/%D0%AA self.assertEqual(escape('Д'), 'Д') # http://en.wikipedia.org/wiki/%D0%94 self.assertEqual( escape('茶'), '茶') # http://en.wiktionary.org/wiki/%E8%8C%B6 self.assertEqual(escape('Λ'), 'Λ') # http://en.wikipedia.org/wiki/Lambda
def test_py2_str(self): self.assertEqual(escape('ъ'.encode('utf-8')), 'ÑŠ') self.assertEqual(escape('Д'.encode('utf-8')), 'Д') self.assertEqual(escape('茶'.encode('utf-8')), '茶') self.assertEqual(escape('Λ'.encode('utf-8')), 'Λ')
def test_tricks(self): self.assertEqual(escape('&'), '&')
def test_mixed(self): self.assertEqual(escape('ab&Λdef'), 'ab&Λdef')
def test_unicode_escape(self): self.assertEqual(escape('ъ'), 'ÑŠ') # http://en.wikipedia.org/wiki/%D0%AA self.assertEqual(escape('Д'), 'Д') # http://en.wikipedia.org/wiki/%D0%94 self.assertEqual(escape('茶'), '茶') # http://en.wiktionary.org/wiki/%E8%8C%B6 self.assertEqual(escape('Λ'), 'Λ') # http://en.wikipedia.org/wiki/Lambda
def test_ascii_escape(self): self.assertEqual(escape('<>&'), '<>&') self.assertEqual(escape('123<abc>456&def'), '123<abc>456&def')
def test_basic(self): self.assertEqual(escape('abc'), 'abc') self.assertEqual(escape('0123'), '0123') self.assertEqual(escape('@$!*'), '@$!*')