[Python-checkins] r85890 - python/branches/issue10209/Lib/test/test_pep277.py
victor.stinner
python-checkins at python.org
Thu Oct 28 15:08:05 CEST 2010
Author: victor.stinner
Date: Thu Oct 28 15:08:05 2010
New Revision: 85890
Log:
test_pep277: normalize the filename to NFC before comparing it
Modified:
python/branches/issue10209/Lib/test/test_pep277.py
Modified: python/branches/issue10209/Lib/test/test_pep277.py
==============================================================================
--- python/branches/issue10209/Lib/test/test_pep277.py (original)
+++ python/branches/issue10209/Lib/test/test_pep277.py Thu Oct 28 15:08:05 2010
@@ -95,8 +95,13 @@
fn(filename)
exc_filename = c.exception.filename
# the "filename" exception attribute may be encoded
+ if sys.platform == 'darwin':
+ # Python functions encode the filename to pass it to the libc, and
+ # then redecode it to create the exception. Encoding normalizes the
+ # filename to NFD, whereas decoding normalizes to NFC.
+ filename = normalize('NFC', filename)
if isinstance(exc_filename, bytes):
- filename = filename.encode(sys.getfilesystemencoding())
+ filename = os.fsencode(filename)
if check_fn_in_exception:
self.assertEqual(exc_filename, filename, "Function '%s(%a) failed "
"with bad filename in the exception: %a" %
More information about the Python-checkins
mailing list