@@ -0,0 +1,1645 @@
+import sys%0Aimport unittest%0Aimport comtypes.client%0Aimport cStringIO%0Aimport ctypes%0A%0Aclass EventsTest(unittest.TestCase):%0A    def setUp(self):%0A        self.old_stdout = sys.stdout%0A        sys.stdout = cStringIO.StringIO()%0A%0A    def tearDown(self):%0A        sys.stdout = self.old_stdout%0A%0A    def test(self):%0A        o = comtypes.client.CreateObject(%22InternetExplorer.Application%22)%0A        conn = comtypes.client.ShowEvents(o)%0A        o.Quit()%0A        del o%0A%0A        # The following code waits for 'timeout' milliseconds in the%0A        # way required for COM, internally doing the correct things%0A        # depending on the COM appartment of the current thread.%0A        timeout = 1000%0A        # We have to supply at least one NULL handle, otherwise%0A        # CoWaitForMultipleHandles complains.%0A        handles = (ctypes.c_void_p * 1)()%0A        RPC_S_CALLPENDING = -2147417835%0A        try:%0A            ctypes.oledll.ole32.CoWaitForMultipleHandles(0,%0A                                                         timeout,%0A                                                         len(handles), handles,%0A                                                         ctypes.byref(ctypes.c_ulong()))%0A        except WindowsError, details:%0A            if details%5B0%5D != RPC_S_CALLPENDING: # timeout expired%0A                raise%0A%0A        stream = sys.stdout%0A        stream.flush()%0A        sys.stdout = self.old_stdout%0A        output = stream.getvalue().splitlines()%0A%0A        self.failUnless('# event found: DWebBrowserEvents2_OnMenuBar' in output)%0A        self.failUnless('Event DWebBrowserEvents2_OnQuit(None)' in output)%0A%0Aif __name__ == %22__main__%22:%0A    unittest.main()%0A

Add test for ShowEvents().