Commit 33a7fcc0 authored by Berker Peksag's avatar Berker Peksag

Issue #23981: Update test_unicodedata to use script_helpers

Patch by Christie.
parent 267597f0
...@@ -9,8 +9,7 @@ ...@@ -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): ...@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment