cf = win32con.CF_TEXT, None, pythoncom.DVASPECT_CONTENT, -1, pythoncom.TYMED_HGLOBAL stg = do.GetData(cf) got = stg.data # The data we get back has the \0, as our STGMEDIUM has no way of # knowing if it meant to be a string, or a binary buffer, so # it must return it too. self.failUnlessEqual(got, str2bytes("Hello again!\0")) def testDataObjectFlush(self): do = TestDataObject("Hello from Python") do = WrapCOMObject(do, iid=pythoncom.IID_IDataObject) pythoncom.OleSetClipboard(do) self.assertEqual(num_do_objects, 1) do = None # clear my ref! pythoncom.OleFlushClipboard() self.assertEqual(num_do_objects, 0) def testDataObjectReset(self): do = TestDataObject("Hello from Python") do = WrapCOMObject(do) pythoncom.OleSetClipboard(do) do = None # clear my ref! self.assertEqual(num_do_objects, 1) pythoncom.OleSetClipboard(None) self.assertEqual(num_do_objects, 0) if __name__=='__main__': from win32com.test import util util.testmain()
def _doTest(self, array): self.arr.Array = array self.failUnlessEqual(_normalize_array(self.arr.Array), array) def testZeroD(self): self._doTest(ZeroD) def testOneDEmpty(self): self._doTest(OneDEmpty) def testOneD(self): self._doTest(OneD) def testTwoD(self): self._doTest(TwoD) def testThreeD(self): self._doTest(ThreeD) def testFourD(self): self._doTest(FourD) def testTwoD1(self): self._doTest(TwoD1) def testOneD1(self): self._doTest(OneD1) def testOneD2(self): self._doTest(OneD2) def testLargeD(self): self._doTest(LargeD) if __name__ == "__main__": try: util.testmain() except SystemExit, rc: if not rc: raise