[pywin32-checkins] pywin32/win32/test test_win32api.py,1.4,1.5
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-10-23 02:33:38
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv14178 Modified Files: test_win32api.py Log Message: Add simple tests for GetShortPathName, GetLongPathName and GetLongPathNameW Index: test_win32api.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32api.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_win32api.py 18 Oct 2003 05:56:27 -0000 1.4 --- test_win32api.py 23 Oct 2003 01:21:09 -0000 1.5 *************** *** 4,7 **** --- 4,8 ---- import win32api, win32con, win32event + import sys, os class CurrentUserTestCase(unittest.TestCase): *************** *** 62,65 **** --- 63,82 ---- ret_code=win32event.WaitForSingleObject(evt,0) self.failUnless(ret_code==win32con.WAIT_OBJECT_0) + + class FileNames(unittest.TestCase): + def testShortLongPathNames(self): + try: + me = __file__ + except NameError: + me = sys.argv[0] + fname = os.path.abspath(me) + short_name = win32api.GetShortPathName(fname) + long_name = win32api.GetLongPathName(short_name) + self.failUnless(long_name==fname, \ + "Expected long name ('%s') to be original name ('%s')" % (long_name, fname)) + long_name = win32api.GetLongPathNameW(short_name) + self.failUnless(type(long_name)==unicode, "GetLongPathNameW returned type '%s'" % (type(long_name),)) + self.failUnless(long_name==fname, \ + "Expected long name ('%s') to be original name ('%s')" % (long_name, fname)) if __name__ == '__main__': |