[Python-checkins] python/dist/src/Lib/test test_unicode_file.py, 1.14, 1.15

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Mon Jun 28 02:57:23 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4262
Modified Files:
	test_unicode_file.py 
Log Message:
Patch from Mark Hammond to fix a test error.
Now runs without exception on WinME/98.
Index: test_unicode_file.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_unicode_file.py	21 Mar 2004 20:55:47 -0000	1.14
--- test_unicode_file.py	28 Jun 2004 06:57:19 -0000	1.15
***************
*** 40,54 ****
 # basename should appear in listdir.
 path, base = os.path.split(os.path.abspath(filename))
! if (isinstance (filename, str)):
! new_base = base.decode(TESTFN_ENCODING)
! file_list = [f.decode(TESTFN_ENCODING) for f in os.listdir(path)]
! else:
! new_base = base 
! file_list = os.listdir(path)
 
! new_base = unicodedata.normalize("NFD", new_base)
 file_list = [unicodedata.normalize("NFD", f) for f in file_list]
 
! self.failUnless(new_base in file_list)
 
 # Do as many "equivalancy' tests as we can - ie, check that although we
--- 40,57 ----
 # basename should appear in listdir.
 path, base = os.path.split(os.path.abspath(filename))
! if isinstance(base, str):
! base = base.decode(TESTFN_ENCODING)
! file_list = os.listdir(path)
! # listdir() with a unicode arg may or may not return Unicode
! # objects, depending on the platform.
! if file_list and isinstance(file_list[0], str):
! file_list = [f.decode(TESTFN_ENCODING) for f in file_list]
 
! # Normalize the unicode strings, as round-tripping the name via the OS
! # may return a different (but equivalent) value.
! base = unicodedata.normalize("NFD", base)
 file_list = [unicodedata.normalize("NFD", f) for f in file_list]
 
! self.failUnless(base in file_list)
 
 # Do as many "equivalancy' tests as we can - ie, check that although we


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /