diff options
Diffstat (limited to 'Lib/test/test_unicodedata.py')
-rw-r--r-- | Lib/test/test_unicodedata.py | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py index 707b30e..6ecc913 100644 --- a/Lib/test/test_unicodedata.py +++ b/Lib/test/test_unicodedata.py @@ -9,8 +9,7 @@ import sys import unittest import hashlib -import subprocess -import test.support +from test.support import script_helper encoding = 'utf-8' errors = 'surrogatepass' @@ -21,7 +20,7 @@ errors = 'surrogatepass' class UnicodeMethodsTest(unittest.TestCase): # update this, if the database changes - expectedchecksum = 'e74e878de71b6e780ffac271785c3cb58f6251f3' + expectedchecksum = '5971760872b2f98bb9c701e6c0db3273d756b3ec' def test_method_checksum(self): h = hashlib.sha1() @@ -79,8 +78,9 @@ class UnicodeDatabaseTest(unittest.TestCase): class UnicodeFunctionsTest(UnicodeDatabaseTest): - # update this, if the database changes - expectedchecksum = 'f0b74d26776331cc7bdc3a4698f037d73f2cee2b' + # Update this if the database changes. Make sure to do a full rebuild + # (e.g. 'make distclean && make') to get the correct checksum. + expectedchecksum = '5e74827cd07f9e546a30f34b7bcf6cc2eac38c8c' def test_function_checksum(self): data = [] h = hashlib.sha1() @@ -233,16 +233,12 @@ class UnicodeMiscTest(UnicodeDatabaseTest): code = "import sys;" \ "sys.modules['unicodedata'] = None;" \ """eval("'\\\\N{SOFT HYPHEN}'")""" - args = [sys.executable, "-c", code] - # We use a subprocess because the unicodedata module may already have - # been loaded in this process. - popen = subprocess.Popen(args, stderr=subprocess.PIPE) - popen.wait() - self.assertEqual(popen.returncode, 1) + # We use a separate process because the unicodedata module may already + # have been loaded in this process. + result = script_helper.assert_python_failure("-c", code) error = "SyntaxError: (unicode error) \\N escapes not supported " \ "(can't load unicodedata module)" - self.assertIn(error, popen.stderr.read().decode("ascii")) - popen.stderr.close() + self.assertIn(error, result.err.decode("ascii")) def test_decimal_numeric_consistent(self): # Test that decimal and numeric are consistent, @@ -312,12 +308,5 @@ class UnicodeMiscTest(UnicodeDatabaseTest): self.assertEqual(len(lines), 1, r"\u%.4x should not be a linebreak" % i) -def test_main(): - test.support.run_unittest( - UnicodeMiscTest, - UnicodeMethodsTest, - UnicodeFunctionsTest - ) - if __name__ == "__main__": - test_main() + unittest.main() |