aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/idna/py3/tests/test_idna_compat.py
blob: cc71c78bd1e639dc633c170593d5951c4e45a378 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python

import unittest

import idna.compat


class IDNACompatTests(unittest.TestCase):
    def testToASCII(self):
        self.assertEqual(
            idna.compat.ToASCII("\u30c6\u30b9\u30c8.xn--zckzah"),
            b"xn--zckzah.xn--zckzah",
        )

    def testToUnicode(self):
        self.assertEqual(
            idna.compat.ToUnicode(b"xn--zckzah.xn--zckzah"),
            "\u30c6\u30b9\u30c8.\u30c6\u30b9\u30c8",
        )

    def test_nameprep(self):
        self.assertRaises(NotImplementedError, idna.compat.nameprep, "a")


if __name__ == "__main__":
    unittest.main()