0001 import pythoncom, win32com.client.dynamic, sys 0002 import winerror 0003 import win32com.test.util 0004 import unittest 0005 0006 def TestConnections(): 0007 import win32com.demos.connect 0008 win32com.demos.connect.test() 0009 0010 class InterpCase(win32com.test.util.TestCase): 0011 def setUp(self): 0012 # Ensure the correct version registered. 0013 from win32com.servers.interp import Interpreter 0014 import win32com.server.register 0015 win32com.server.register.RegisterClasses(Interpreter, quiet=1) 0016 0017 def _testInterp(self, interp): 0018 self.assertEquals(interp.Eval("1+1"), 2) 0019 win32com.test.util.assertRaisesCOM_HRESULT(self, winerror.DISP_E_TYPEMISMATCH, 0020 interp.Eval, 2) 0021 0022 def testInproc(self): 0023 interp = win32com.client.dynamic.Dispatch("Python.Interpreter", clsctx = pythoncom.CLSCTX_INPROC) 0024 self._testInterp(interp) 0025 0026 def testLocalServer(self): 0027 interp = win32com.client.dynamic.Dispatch("Python.Interpreter", clsctx = pythoncom.CLSCTX_LOCAL_SERVER) 0028 self._testInterp(interp) 0029 0030 def testAny(self): 0031 interp = win32com.client.dynamic.Dispatch("Python.Interpreter") 0032 self._testInterp(interp) 0033 0034 class ConnectionsTestCase(win32com.test.util.TestCase): 0035 def testConnections(self): 0036 TestConnections() 0037 0038 if __name__=='__main__': 0039 unittest.main('testServers') 0040
Generated by PyXR 0.9.4