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

Method test_named_sequences_full

Lib/test/test_ucn.py:207–233  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

205 unicodedata.ucd_3_2_0.lookup(seqname)
206
207 def test_named_sequences_full(self):
208 # Check all the named sequences
209 def check_version(testfile):
210 hdr = testfile.readline()
211 return unicodedata.unidata_version in hdr
212 url = ("http://www.pythontest.net/unicode/%s/NamedSequences.txt" %
213 unicodedata.unidata_version)
214 try:
215 testdata = support.open_urlresource(url, encoding="utf-8",
216 check=check_version)
217 except urllib.error.HTTPError as exc:
218 exc.close()
219 self.skipTest(f"Could not retrieve {url}: {exc!r}")
220 except (OSError, HTTPException) as exc:
221 self.skipTest(f"Could not retrieve {url}: {exc!r}")
222 with testdata:
223 for line in testdata:
224 line = line.strip()
225 if not line or line.startswith('#'):
226 continue
227 seqname, codepoints = line.split(';')
228 codepoints = ''.join(chr(int(cp, 16)) for cp in codepoints.split())
229 self.assertEqual(unicodedata.lookup(seqname), codepoints)
230 with self.assertRaises(SyntaxError):
231 self.checkletter(seqname, None)
232 with self.assertRaises(KeyError):
233 unicodedata.ucd_3_2_0.lookup(seqname)
234
235 def test_errors(self):
236 self.assertRaises(TypeError, unicodedata.name)

Callers

nothing calls this directly

Calls 10

checkletterMethod · 0.95
skipTestMethod · 0.80
closeMethod · 0.45
stripMethod · 0.45
startswithMethod · 0.45
splitMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45
lookupMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected