MCPcopy Index your code
hub / github.com/python/cpython / test_nameprep

Method test_nameprep

Lib/test/test_codecs.py:1559–1575  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1557
1558class 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
1578class IDNACodecTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

nameprepFunction · 0.90
enumerateFunction · 0.85
strFunction · 0.85
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected