(self)
| 1557 | |
| 1558 | class NameprepTest(unittest.TestCase): |
| 1559 | def test_nameprep(self): |
| 1560 | from encodings.idna import nameprep |
| 1561 | for pos, (orig, prepped) in enumerate(nameprep_tests): |
| 1562 | if orig is None: |
| 1563 | # Skipped |
| 1564 | continue |
| 1565 | # The Unicode strings are given in UTF-8 |
| 1566 | orig = str(orig, "utf-8", "surrogatepass") |
| 1567 | if prepped is None: |
| 1568 | # Input contains prohibited characters |
| 1569 | self.assertRaises(UnicodeEncodeError, nameprep, orig) |
| 1570 | else: |
| 1571 | prepped = str(prepped, "utf-8", "surrogatepass") |
| 1572 | try: |
| 1573 | self.assertEqual(nameprep(orig), prepped) |
| 1574 | except Exception as e: |
| 1575 | raise support.TestFailed("Test 3.%d: %s" % (pos+1, str(e))) |
| 1576 | |
| 1577 | |
| 1578 | class IDNACodecTest(unittest.TestCase): |
nothing calls this directly
no test coverage detected