summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ucn.py
diff options
context:
space:
mode:
authorGreg Price <gnprice@gmail.com>2019-09-10 09:29:26 (GMT)
committerBenjamin Peterson <benjamin@python.org>2019-09-10 09:29:26 (GMT)
commit1ad0c776cb640be9f19c8019bbf34bb4aba312ad (patch)
tree8a8b417f7ccc6761385b95227dcd883519111241 /Lib/test/test_ucn.py
parent5b00dd8fa8e28acbf1ad7ce6da52464f33dbf991 (diff)
downloadcpython-1ad0c776cb640be9f19c8019bbf34bb4aba312ad.zip
cpython-1ad0c776cb640be9f19c8019bbf34bb4aba312ad.tar.gz
cpython-1ad0c776cb640be9f19c8019bbf34bb4aba312ad.tar.bz2
bpo-38043: Move unicodedata.normalize tests into test_unicodedata. (GH-15712)
Having these in a separate file from the one that's named after the module in the usual way makes it very easy to miss them when looking for tests for these two functions. (In fact when working recently on is_normalized, I'd been surprised to see no tests for it here and concluded the function had evaded being tested at all. I'd gone as far as to write up some tests myself before I spotted this other file.) Mostly this just means moving all the one file's code into the other, and moving code from the module toplevel to inside the test class to keep it tidily separate from the rest of the file's code. There's one substantive change, which reduces by a bit the amount of code to be moved: we drop the `x > sys.maxunicode` conditional and all the `RangeError` logic behind it. Now if that condition ever occurs it will cause an error at `chr(x)`, and a test failure. That's the right result because, since PEP 393 in Python 3.3, there is no longer such a thing as an "unsupported character".
Diffstat (limited to 'Lib/test/test_ucn.py')
-rw-r--r--Lib/test/test_ucn.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py
index 8febf0a..503df6a 100644
--- a/Lib/test/test_ucn.py
+++ b/Lib/test/test_ucn.py
@@ -12,7 +12,6 @@ import unicodedata
from test import support
from http.client import HTTPException
-from test.test_normalization import check_version
try:
from _testcapi import INT_MAX, PY_SSIZE_T_MAX, UINT_MAX
@@ -172,6 +171,9 @@ class UnicodeNamesTest(unittest.TestCase):
def test_named_sequences_full(self):
# Check all the named sequences
+ def check_version(testfile):
+ hdr = testfile.readline()
+ return unicodedata.unidata_version in hdr
url = ("http://www.pythontest.net/unicode/%s/NamedSequences.txt" %
unicodedata.unidata_version)
try: