test_idna_compat.py 534 B

12345678910111213141516171819
  1. #!/usr/bin/env python
  2. import unittest
  3. import idna.compat
  4. class IDNACompatTests(unittest.TestCase):
  5. def testToASCII(self):
  6. self.assertEqual(idna.compat.ToASCII(u'\u30c6\u30b9\u30c8.xn--zckzah'), b'xn--zckzah.xn--zckzah')
  7. def testToUnicode(self):
  8. self.assertEqual(idna.compat.ToUnicode(b'xn--zckzah.xn--zckzah'), u'\u30c6\u30b9\u30c8.\u30c6\u30b9\u30c8')
  9. def test_nameprep(self):
  10. self.assertRaises(NotImplementedError, idna.compat.nameprep, "a")
  11. if __name__ == '__main__':
  12. unittest.main()