(self)
| 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) |
nothing calls this directly
no test coverage detected