[pywin32-checkins] pywin32/com/win32com/test testShell.py,1.2,1.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2004-04-09 11:38:57
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29393/com/win32com/test Modified Files: testShell.py Log Message: Add PIDL and CIDA tests. Index: testShell.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testShell.py 10 Nov 2003 00:49:29 -0000 1.2 --- testShell.py 9 Apr 2004 11:25:36 -0000 1.3 *************** *** 45,48 **** --- 45,79 ---- self.assertEqual(names_1, names_2) + class PIDLTester(win32com.test.util.TestCase): + def _rtPIDL(self, pidl): + pidl_str = shell.PIDLAsString(pidl) + pidl_rt = shell.StringAsPIDL(pidl_str) + self.assertEqual(pidl_rt, pidl) + pidl_str_rt = shell.PIDLAsString(pidl_rt) + self.assertEqual(pidl_str_rt, pidl_str) + + def _rtCIDA(self, parent, kids): + cida = parent, kids + cida_str = shell.CIDAAsString(cida) + cida_rt = shell.StringAsCIDA(cida_str) + self.assertEqual(cida, cida_rt) + cida_str_rt = shell.CIDAAsString(cida_rt) + self.assertEqual(cida_str_rt, cida_str) + + 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"] ]) + if __name__=='__main__': unittest.main() |