mirror of
https://github.com/python/cpython.git
synced 2025-10-02 21:25:24 +00:00
Issue #23981: Update test_unicodedata to use script_helpers
Patch by Christie.
This commit is contained in:
commit
23c9f612d6
1 changed files with 5 additions and 10 deletions
|
@ -9,8 +9,7 @@
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import hashlib
|
import hashlib
|
||||||
import subprocess
|
from test.support import script_helper
|
||||||
import test.support
|
|
||||||
|
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
errors = 'surrogatepass'
|
errors = 'surrogatepass'
|
||||||
|
@ -234,16 +233,12 @@ class UnicodeMiscTest(UnicodeDatabaseTest):
|
||||||
code = "import sys;" \
|
code = "import sys;" \
|
||||||
"sys.modules['unicodedata'] = None;" \
|
"sys.modules['unicodedata'] = None;" \
|
||||||
"""eval("'\\\\N{SOFT HYPHEN}'")"""
|
"""eval("'\\\\N{SOFT HYPHEN}'")"""
|
||||||
args = [sys.executable, "-c", code]
|
# We use a separate process because the unicodedata module may already
|
||||||
# We use a subprocess because the unicodedata module may already have
|
# have been loaded in this process.
|
||||||
# been loaded in this process.
|
result = script_helper.assert_python_failure("-c", code)
|
||||||
popen = subprocess.Popen(args, stderr=subprocess.PIPE)
|
|
||||||
popen.wait()
|
|
||||||
self.assertEqual(popen.returncode, 1)
|
|
||||||
error = "SyntaxError: (unicode error) \\N escapes not supported " \
|
error = "SyntaxError: (unicode error) \\N escapes not supported " \
|
||||||
"(can't load unicodedata module)"
|
"(can't load unicodedata module)"
|
||||||
self.assertIn(error, popen.stderr.read().decode("ascii"))
|
self.assertIn(error, result.err.decode("ascii"))
|
||||||
popen.stderr.close()
|
|
||||||
|
|
||||||
def test_decimal_numeric_consistent(self):
|
def test_decimal_numeric_consistent(self):
|
||||||
# Test that decimal and numeric are consistent,
|
# Test that decimal and numeric are consistent,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue