[pywin32-checkins] pywin32/com/win32com/test testPyComTest.py,1.20,1.21
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2005-06-08 05:19:17
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2167/test Modified Files: testPyComTest.py Log Message: * Allow _com_interfaces_ to be IIDs *and* interface names from a typelib. Previously you could not mix and match * Allow IID-like strings to be specified in _com_interfaces_ * Raise a value error when an invalid interface name is passed for registration * Tests Index: testPyComTest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** testPyComTest.py 31 May 2005 12:36:03 -0000 1.20 --- testPyComTest.py 8 Jun 2005 05:19:04 -0000 1.21 *************** *** 15,19 **** # This test uses a Python implemented COM server - ensure correctly registered. ! RegisterPythonServer(os.path.join(win32com.__path__[0], "servers", "test_pycomtest.py")) from win32com.client import gencache --- 15,19 ---- # This test uses a Python implemented COM server - ensure correctly registered. ! RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py")) from win32com.client import gencache *************** *** 344,347 **** --- 344,365 ---- pass + def TestVTableMI(): + clsctx = pythoncom.CLSCTX_SERVER + ob = pythoncom.CoCreateInstance("Python.Test.PyCOMTestMI", None, clsctx, pythoncom.IID_IUnknown) + # This inherits from IStream. + ob.QueryInterface(pythoncom.IID_IStream) + # This implements IStorage, specifying the IID as a string + ob.QueryInterface(pythoncom.IID_IStorage) + # IDispatch should always work + ob.QueryInterface(pythoncom.IID_IDispatch) + + iid = pythoncom.InterfaceNames["IPyCOMTest"] + try: + ob.QueryInterface(iid) + except TypeError: + # Python can't actually _use_ this interface yet, so this is + # "expected". Any COM error is not. + pass + def TestQueryInterface(long_lived_server = 0, iterations=5): tester = win32com.client.Dispatch("PyCOMTest.PyCOMTest") *************** *** 372,375 **** --- 390,396 ---- for i in range(3): TestVTable2() + def testVTableMI(self): + for i in range(3): + TestVTableMI() def testMultiQueryInterface(self): TestQueryInterface(0,6) |