Commit 0ea31a93 authored by Victor Stinner's avatar Victor Stinner

Recorded merge of revisions 83987 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83987 | victor.stinner | 2010-08-14 00:23:24 +0200 (sam., 14 août 2010) | 2 lines

  Fix a typo: TESTFN_UNENCODEABLE => TESTFN_UNENCODABLE
........
parent 0d823ed4
...@@ -343,13 +343,13 @@ else: ...@@ -343,13 +343,13 @@ else:
# file system encoding, but *not* with the default (ascii) encoding # file system encoding, but *not* with the default (ascii) encoding
TESTFN_UNICODE = "@test-\xe0\xf2" TESTFN_UNICODE = "@test-\xe0\xf2"
TESTFN_ENCODING = sys.getfilesystemencoding() TESTFN_ENCODING = sys.getfilesystemencoding()
# TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be # TESTFN_UNENCODABLE is a filename that should *not* be
# able to be encoded by *either* the default or filesystem encoding. # able to be encoded by *either* the default or filesystem encoding.
# This test really only makes sense on Windows NT platforms # This test really only makes sense on Windows NT platforms
# which have special Unicode support in posixmodule. # which have special Unicode support in posixmodule.
if (not hasattr(sys, "getwindowsversion") or if (not hasattr(sys, "getwindowsversion") or
sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME
TESTFN_UNICODE_UNENCODEABLE = None TESTFN_UNENCODABLE = None
else: else:
# Different kinds of characters from various languages to minimize the # Different kinds of characters from various languages to minimize the
# probability that the whole name is encodable to MBCS (issue #9819) # probability that the whole name is encodable to MBCS (issue #9819)
...@@ -360,13 +360,13 @@ else: ...@@ -360,13 +360,13 @@ else:
# errors=ignore' mode - hence we get '?' characters rather than # errors=ignore' mode - hence we get '?' characters rather than
# the exception. 'Latin1' operates as we expect - ie, fails. # the exception. 'Latin1' operates as we expect - ie, fails.
# See [ 850997 ] mbcs encoding ignores errors # See [ 850997 ] mbcs encoding ignores errors
TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") TESTFN_UNENCODABLE.encode("Latin1")
except UnicodeEncodeError: except UnicodeEncodeError:
pass pass
else: else:
print('WARNING: The filename %r CAN be encoded by the filesystem. ' print('WARNING: The filename %r CAN be encoded by the filesystem. '
'Unicode filename tests may not be effective' 'Unicode filename tests may not be effective'
% TESTFN_UNICODE_UNENCODEABLE) % TESTFN_UNENCODABLE)
if os.path.isdir(TESTFN): if os.path.isdir(TESTFN):
# a test failed (eg. test_os) without removing TESTFN directory # a test failed (eg. test_os) without removing TESTFN directory
......
...@@ -6,7 +6,7 @@ import unicodedata ...@@ -6,7 +6,7 @@ import unicodedata
import unittest import unittest
from test.support import run_unittest, TESTFN_UNICODE, rmtree from test.support import run_unittest, TESTFN_UNICODE, rmtree
from test.support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE from test.support import TESTFN_ENCODING, TESTFN_UNENCODABLE
try: try:
TESTFN_UNICODE.encode(TESTFN_ENCODING) TESTFN_UNICODE.encode(TESTFN_ENCODING)
except (UnicodeError, TypeError): except (UnicodeError, TypeError):
...@@ -146,8 +146,8 @@ class TestUnicodeFiles(unittest.TestCase): ...@@ -146,8 +146,8 @@ class TestUnicodeFiles(unittest.TestCase):
# _test functions with each of the filename combinations we wish to test # _test functions with each of the filename combinations we wish to test
def test_single_files(self): def test_single_files(self):
self._test_single(TESTFN_UNICODE) self._test_single(TESTFN_UNICODE)
if TESTFN_UNICODE_UNENCODEABLE is not None: if TESTFN_UNENCODABLE is not None:
self._test_single(TESTFN_UNICODE_UNENCODEABLE) self._test_single(TESTFN_UNENCODABLE)
def test_directories(self): def test_directories(self):
# For all 'equivalent' combinations: # For all 'equivalent' combinations:
...@@ -156,9 +156,9 @@ class TestUnicodeFiles(unittest.TestCase): ...@@ -156,9 +156,9 @@ class TestUnicodeFiles(unittest.TestCase):
ext = ".dir" ext = ".dir"
self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, False) self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, False)
# Our directory name that can't use a non-unicode name. # Our directory name that can't use a non-unicode name.
if TESTFN_UNICODE_UNENCODEABLE is not None: if TESTFN_UNENCODABLE is not None:
self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext, self._do_directory(TESTFN_UNENCODABLE+ext,
TESTFN_UNICODE_UNENCODEABLE+ext, TESTFN_UNENCODABLE+ext,
False) False)
def test_main(): def test_main():
......
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