[pywin32-checkins] pywin32/win32/test test_win32api.py,1.8,1.9
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2006-03-15 04:00:48
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1503/win32/test Modified Files: test_win32api.py Log Message: win32api.GetFileAttributes will call GetFileAttributesW if passed with a Unicode object (previously it would throw a type-error) Index: test_win32api.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32api.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_win32api.py 4 Mar 2005 11:50:32 -0000 1.8 --- test_win32api.py 15 Mar 2006 04:00:08 -0000 1.9 *************** *** 107,110 **** --- 107,121 ---- raise try: + # GetFileAttributes automatically calls GetFileAttributesW when + # passed unicode + try: + attr = win32api.GetFileAttributes(fname) + except win32api.error, details: + if details[0] != winerror.ERROR_FILENAME_EXCED_RANGE: + raise + + attr = win32api.GetFileAttributes(unicode(fname)) + self.failUnless(attr & win32con.FILE_ATTRIBUTE_DIRECTORY, attr) + long_name = win32api.GetLongPathNameW(fname) self.failUnlessEqual(long_name, fname) |