Update test_ucn.py from 3.13.7

This commit is contained in:
ShaharNaveh
2025-08-24 00:17:50 +03:00
parent 61bc6e8d1c
commit d28164c150
4 changed files with 29 additions and 25 deletions

5
.gitignore vendored
View File

@@ -21,3 +21,8 @@ flamescope.json
extra_tests/snippets/resources
extra_tests/not_impl.py
Lib/site-packages/*
!Lib/site-packages/README.txt
Lib/test/data/*
!Lib/test/data/README

46
Lib/test/test_ucn.py vendored
View File

@@ -10,6 +10,7 @@ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
import ast
import unittest
import unicodedata
import urllib.error
from test import support
from http.client import HTTPException
@@ -115,8 +116,7 @@ class UnicodeNamesTest(unittest.TestCase):
self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", "\uFF9F")
self.checkletter("FULLWIDTH LATIN SMALL LETTER A", "\uFF41")
# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.expectedFailure # TODO: RUSTPYTHON
def test_aliases(self):
# Check that the aliases defined in the NameAliases.txt file work.
# This should be updated when new aliases are added or the file
@@ -143,8 +143,6 @@ class UnicodeNamesTest(unittest.TestCase):
with self.assertRaises(KeyError):
unicodedata.ucd_3_2_0.lookup(alias)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_aliases_names_in_pua_range(self):
# We are storing aliases in the PUA 15, but their names shouldn't leak
for cp in range(0xf0000, 0xf0100):
@@ -152,8 +150,6 @@ class UnicodeNamesTest(unittest.TestCase):
unicodedata.name(chr(cp))
self.assertEqual(str(cm.exception), 'no such name')
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_named_sequences_names_in_pua_range(self):
# We are storing named seq in the PUA 15, but their names shouldn't leak
for cp in range(0xf0100, 0xf0fff):
@@ -161,8 +157,7 @@ class UnicodeNamesTest(unittest.TestCase):
unicodedata.name(chr(cp))
self.assertEqual(str(cm.exception), 'no such name')
# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.expectedFailure # TODO: RUSTPYTHON
def test_named_sequences_sample(self):
# Check a few named sequences. See #12753.
sequences = [
@@ -179,6 +174,7 @@ class UnicodeNamesTest(unittest.TestCase):
with self.assertRaises(KeyError):
unicodedata.ucd_3_2_0.lookup(seqname)
@unittest.expectedFailure # TODO: RUSTPYTHON
def test_named_sequences_full(self):
# Check all the named sequences
def check_version(testfile):
@@ -189,23 +185,25 @@ class UnicodeNamesTest(unittest.TestCase):
try:
testdata = support.open_urlresource(url, encoding="utf-8",
check=check_version)
except (OSError, HTTPException):
self.skipTest("Could not retrieve " + url)
self.addCleanup(testdata.close)
for line in testdata:
line = line.strip()
if not line or line.startswith('#'):
continue
seqname, codepoints = line.split(';')
codepoints = ''.join(chr(int(cp, 16)) for cp in codepoints.split())
self.assertEqual(unicodedata.lookup(seqname), codepoints)
with self.assertRaises(SyntaxError):
self.checkletter(seqname, None)
with self.assertRaises(KeyError):
unicodedata.ucd_3_2_0.lookup(seqname)
except urllib.error.HTTPError as exc:
exc.close()
self.skipTest(f"Could not retrieve {url}: {exc!r}")
except (OSError, HTTPException) as exc:
self.skipTest(f"Could not retrieve {url}: {exc!r}")
with testdata:
for line in testdata:
line = line.strip()
if not line or line.startswith('#'):
continue
seqname, codepoints = line.split(';')
codepoints = ''.join(chr(int(cp, 16)) for cp in codepoints.split())
self.assertEqual(unicodedata.lookup(seqname), codepoints)
with self.assertRaises(SyntaxError):
self.checkletter(seqname, None)
with self.assertRaises(KeyError):
unicodedata.ucd_3_2_0.lookup(seqname)
# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.expectedFailure # TODO: RUSTPYTHON
def test_errors(self):
self.assertRaises(TypeError, unicodedata.name)
self.assertRaises(TypeError, unicodedata.name, 'xx')

View File

@@ -414,6 +414,7 @@ class NormalizationTest(unittest.TestCase):
data = [int(x, 16) for x in data.split(" ")]
return "".join([chr(x) for x in data])
@unittest.expectedFailure # TODO: RUSTPYTHON
@requires_resource('network')
@requires_resource('cpu')
def test_normalization(self):

View File

@@ -145,7 +145,7 @@ mod unicodedata {
}
}
}
default.ok_or_else(|| vm.new_value_error("character name not found!"))
default.ok_or_else(|| vm.new_value_error("no such name"))
}
#[pymethod]