[pywin32-checkins] pywin32/com/win32com/test testShell.py, 1.10, 1.10.4.1
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-13 14:40:45
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22758 Modified Files: Tag: py3k testShell.py Log Message: Pass PIDL's as byte strings Index: testShell.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -C2 -d -r1.10 -r1.10.4.1 *** testShell.py 22 Sep 2006 05:05:51 -0000 1.10 --- testShell.py 13 Sep 2008 14:40:54 -0000 1.10.4.1 *************** *** 31,35 **** if num == 0: # This isn't a fatal error, but is unlikely. ! print "Could not find any links on your desktop, which is unusual" def testShellFolder(self): --- 31,35 ---- if num == 0: # This isn't a fatal error, but is unlikely. ! print ("Could not find any links on your desktop, which is unusual") def testShellFolder(self): *************** *** 68,87 **** def testPIDL(self): # A PIDL of "\1" is: cb pidl cb ! expect = "\03\00" "\1" "\0\0" ! self.assertEqual(shell.PIDLAsString(["\1"]), expect) ! self._rtPIDL(["\0"]) ! self._rtPIDL(["\1", "\2", "\3"]) ! self._rtPIDL(["\0" * 2048] * 2048) # PIDL must be a list self.assertRaises(TypeError, shell.PIDLAsString, "foo") def testCIDA(self): ! self._rtCIDA(["\0"], [ ["\0"] ]) ! self._rtCIDA(["\1"], [ ["\2"] ]) ! self._rtCIDA(["\0"], [ ["\0"], ["\1"], ["\2"] ]) def testBadShortPIDL(self): # A too-short child element: cb pidl cb ! pidl = "\01\00" "\1" self.assertRaises(ValueError, shell.StringAsPIDL, pidl) --- 68,87 ---- def testPIDL(self): # A PIDL of "\1" is: cb pidl cb ! expect = b"\03\00" b"\1" b"\0\0" ! self.assertEqual(shell.PIDLAsString([b"\1"]), expect) ! self._rtPIDL([b"\0"]) ! self._rtPIDL([b"\1", b"\2", b"\3"]) ! self._rtPIDL([b"\0" * 2048] * 2048) # PIDL must be a list self.assertRaises(TypeError, shell.PIDLAsString, "foo") def testCIDA(self): ! self._rtCIDA([b"\0"], [ [b"\0"] ]) ! self._rtCIDA([b"\1"], [ [b"\2"] ]) ! self._rtCIDA([b"\0"], [ [b"\0"], [b"\1"], [b"\2"] ]) def testBadShortPIDL(self): # A too-short child element: cb pidl cb ! pidl = b"\01\00" b"\1" self.assertRaises(ValueError, shell.StringAsPIDL, pidl) *************** *** 91,96 **** class FILEGROUPDESCRIPTORTester(win32com.test.util.TestCase): def _testRT(self, fd): ! fgd_string = shell.FILEGROUPDESCRIPTORAsString([fd]) ! fd2 = shell.StringAsFILEGROUPDESCRIPTOR(fgd_string)[0] fd = fd.copy() --- 91,96 ---- class FILEGROUPDESCRIPTORTester(win32com.test.util.TestCase): def _testRT(self, fd): ! fgd_string = shell.FILEGROUPDESCRIPTORAsString([fd], 1) ! fd2 = shell.StringAsFILEGROUPDESCRIPTOR(fgd_string, 1)[0] fd = fd.copy() *************** *** 98,104 **** # The returned objects *always* have dwFlags and cFileName. ! if not fd.has_key('dwFlags'): del fd2['dwFlags'] ! if not fd.has_key('cFileName'): self.assertEqual(fd2['cFileName'], '') del fd2['cFileName'] --- 98,104 ---- # The returned objects *always* have dwFlags and cFileName. ! if 'dwFlags' not in fd: del fd2['dwFlags'] ! if 'cFileName' not in fd: self.assertEqual(fd2['cFileName'], '') del fd2['cFileName'] *************** *** 130,134 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxint + 1) self._testRT(d) --- 130,134 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1) self._testRT(d) *************** *** 138,142 **** # no kw-args to dict in 2.2 - not worth converting! return ! d = [dict(cFileName=u"foo.txt", sizel=(1,2), pointl=(3,4), --- 138,142 ---- # no kw-args to dict in 2.2 - not worth converting! return ! d = [dict(cFileName="foo.txt", sizel=(1,2), pointl=(3,4), *************** *** 145,150 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxint + 1), ! dict(cFileName=u"foo2.txt", sizel=(1,2), pointl=(3,4), --- 145,150 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1), ! dict(cFileName="foo2.txt", sizel=(1,2), pointl=(3,4), *************** *** 153,158 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxint + 1), ! dict(cFileName=u"foo\xa9.txt", sizel=(1,2), pointl=(3,4), --- 153,158 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1), ! dict(cFileName="foo\xa9.txt", sizel=(1,2), pointl=(3,4), *************** *** 161,165 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxint + 1), ] s = shell.FILEGROUPDESCRIPTORAsString(d, 1) --- 161,165 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1), ] s = shell.FILEGROUPDESCRIPTORAsString(d, 1) *************** *** 175,180 **** self.src_name = os.path.join(tempfile.gettempdir(), "pywin32_testshell") self.dest_name = os.path.join(tempfile.gettempdir(), "pywin32_testshell_dest") ! self.test_data = "Hello from\0Python" ! f=file(self.src_name, "wb") f.write(self.test_data) f.close() --- 175,180 ---- self.src_name = os.path.join(tempfile.gettempdir(), "pywin32_testshell") self.dest_name = os.path.join(tempfile.gettempdir(), "pywin32_testshell_dest") ! self.test_data = b"Hello from\0Python" ! f=open(self.src_name, "wb") f.write(self.test_data) f.close() |