mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
Explicitly use UTF-8 as the encoding for the normalization file.
This commit is contained in:
parent
5495957b6c
commit
234a34a564
2 changed files with 4 additions and 4 deletions
|
@ -33,7 +33,7 @@ def unistr(data):
|
||||||
class NormalizationTest(unittest.TestCase):
|
class NormalizationTest(unittest.TestCase):
|
||||||
def test_main(self):
|
def test_main(self):
|
||||||
part1_data = {}
|
part1_data = {}
|
||||||
for line in open_urlresource(TESTDATAURL):
|
for line in open_urlresource(TESTDATAURL, encoding="utf-8"):
|
||||||
if '#' in line:
|
if '#' in line:
|
||||||
line = line.split('#')[0]
|
line = line.split('#')[0]
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|
|
@ -244,7 +244,7 @@ def check_syntax_error(testcase, statement):
|
||||||
else:
|
else:
|
||||||
testcase.fail('Missing SyntaxError: "%s"' % statement)
|
testcase.fail('Missing SyntaxError: "%s"' % statement)
|
||||||
|
|
||||||
def open_urlresource(url):
|
def open_urlresource(url, *args, **kw):
|
||||||
import urllib, urlparse
|
import urllib, urlparse
|
||||||
|
|
||||||
requires('urlfetch')
|
requires('urlfetch')
|
||||||
|
@ -253,11 +253,11 @@ def open_urlresource(url):
|
||||||
for path in [os.path.curdir, os.path.pardir]:
|
for path in [os.path.curdir, os.path.pardir]:
|
||||||
fn = os.path.join(path, filename)
|
fn = os.path.join(path, filename)
|
||||||
if os.path.exists(fn):
|
if os.path.exists(fn):
|
||||||
return open(fn)
|
return open(fn, *args, **kw)
|
||||||
|
|
||||||
print('\tfetching %s ...' % url, file=get_original_stdout())
|
print('\tfetching %s ...' % url, file=get_original_stdout())
|
||||||
fn, _ = urllib.urlretrieve(url, filename)
|
fn, _ = urllib.urlretrieve(url, filename)
|
||||||
return open(fn)
|
return open(fn, *args, **kw)
|
||||||
|
|
||||||
|
|
||||||
class WarningMessage(object):
|
class WarningMessage(object):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue