Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

testServers.py 1.4KB

1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import unittest
  2. import pythoncom
  3. import win32com.client.dynamic
  4. import win32com.test.util
  5. import winerror
  6. def TestConnections():
  7. import win32com.demos.connect
  8. win32com.demos.connect.test()
  9. class InterpCase(win32com.test.util.TestCase):
  10. def setUp(self):
  11. # Ensure the correct version registered.
  12. from win32com.servers import interp
  13. from win32com.test.util import RegisterPythonServer
  14. RegisterPythonServer(interp.__file__, "Python.Interpreter")
  15. def _testInterp(self, interp):
  16. self.assertEqual(interp.Eval("1+1"), 2)
  17. win32com.test.util.assertRaisesCOM_HRESULT(
  18. self, winerror.DISP_E_TYPEMISMATCH, interp.Eval, 2
  19. )
  20. def testInproc(self):
  21. interp = win32com.client.dynamic.Dispatch(
  22. "Python.Interpreter", clsctx=pythoncom.CLSCTX_INPROC
  23. )
  24. self._testInterp(interp)
  25. def testLocalServer(self):
  26. interp = win32com.client.dynamic.Dispatch(
  27. "Python.Interpreter", clsctx=pythoncom.CLSCTX_LOCAL_SERVER
  28. )
  29. self._testInterp(interp)
  30. def testAny(self):
  31. interp = win32com.client.dynamic.Dispatch("Python.Interpreter")
  32. self._testInterp(interp)
  33. class ConnectionsTestCase(win32com.test.util.TestCase):
  34. def testConnections(self):
  35. TestConnections()
  36. if __name__ == "__main__":
  37. unittest.main("testServers")