File: test_idna_compat.py

package info (click to toggle)
python-idna 2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 572 kB
  • sloc: python: 11,779; sh: 6; makefile: 3
file content (19 lines) | stat: -rwxr-xr-x 534 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python

import unittest

import idna.compat

class IDNACompatTests(unittest.TestCase):

    def testToASCII(self):
        self.assertEqual(idna.compat.ToASCII(u'\u30c6\u30b9\u30c8.xn--zckzah'), b'xn--zckzah.xn--zckzah')

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

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

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