home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Shareware / Comunicatii / jyte / jyte.exe / test_pycomtest.py < prev    next >
Text File  |  2002-11-19  |  4KB  |  130 lines

  1. # This is part of the Python test suite.
  2. # The object is registered when you first run the test suite.
  3. # (and hopefully unregistered once done ;-)
  4.  
  5. # Ensure the vtables in the tlb are known.
  6. from win32com import universal
  7. from win32com.server.exception import COMException
  8. from win32com.client import gencache
  9. import winerror
  10. from win32com.client import constants
  11. from win32com.server.util import wrap
  12.  
  13. # We use the constants from the module, so must insist on a gencache.
  14. # Otherwise, use of gencache is not necessary (tho still advised)
  15. gencache.EnsureModule('{6BCDCB60-5605-11D0-AE5F-CADD4C000000}', 0, 1, 1)
  16.  
  17. class PyCOMTest:
  18.     _typelib_guid_ = "{6BCDCB60-5605-11D0-AE5F-CADD4C000000}"
  19.     _typelib_version = 1,0
  20.     _com_interfaces_ = ['IPyCOMTest']
  21.     _reg_clsid_ = "{e743d9cd-cb03-4b04-b516-11d3a81c1597}"
  22.     _reg_progid_ = "Python.Test.PyCOMTest"
  23.  
  24.     def DoubleString(self, str):
  25.         return str*2
  26.     def DoubleInOutString(self, str):
  27.         return str*2
  28.  
  29.     def Fire(self, nID):
  30.         raise COMException(hresult=winerror.E_NOTIMPL)
  31.  
  32.     def GetLastVarArgs(self):
  33.         raise COMException(hresult=winerror.E_NOTIMPL)
  34.  
  35.     def GetMultipleInterfaces(self, outinterface1, outinterface2):
  36.         raise COMException(hresult=winerror.E_NOTIMPL)
  37.  
  38.     def GetSafeArrays(self, attrs, attrs2, ints):
  39.         raise COMException(hresult=winerror.E_NOTIMPL)
  40.  
  41.     def GetSetDispatch(self, indisp):
  42.         raise COMException(hresult=winerror.E_NOTIMPL)
  43.  
  44.     # Result is of type IPyCOMTest
  45.     def GetSetInterface(self, ininterface):
  46.         return wrap(self)
  47.  
  48.     # Result is of type IPyCOMTest
  49.     def GetSetInterfaceArray(self, ininterface):
  50.         raise COMException(hresult=winerror.E_NOTIMPL)
  51.  
  52.     def GetSetUnknown(self, inunk):
  53.         raise COMException(hresult=winerror.E_NOTIMPL)
  54.  
  55.     # Result is of type ISimpleCounter
  56.     def GetSimpleCounter(self):
  57.         raise COMException(hresult=winerror.E_NOTIMPL)
  58.  
  59.     def GetSimpleSafeArray(self, ints):
  60.         raise COMException(hresult=winerror.E_NOTIMPL)
  61.  
  62.     def GetStruct(self):
  63.         raise COMException(hresult=winerror.E_NOTIMPL)
  64.  
  65.     def SetIntSafeArray(self, ints):
  66.         return len(ints)
  67.  
  68.     def SetVarArgs(self, *args):
  69.         raise COMException(hresult=winerror.E_NOTIMPL)
  70.  
  71.     def SetVariantSafeArray(self, vars):
  72.         raise COMException(hresult=winerror.E_NOTIMPL)
  73.  
  74.     def Start(self):
  75.         raise COMException(hresult=winerror.E_NOTIMPL)
  76.  
  77.     def Stop(self, nID):
  78.         raise COMException(hresult=winerror.E_NOTIMPL)
  79.  
  80.     def StopAll(self):
  81.         raise COMException(hresult=winerror.E_NOTIMPL)
  82.  
  83.     def TakeByRefDispatch(self, inout):
  84.         raise COMException(hresult=winerror.E_NOTIMPL)
  85.  
  86.     def TakeByRefTypedDispatch(self, inout):
  87.         raise COMException(hresult=winerror.E_NOTIMPL)
  88.  
  89.     def Test(self, key, inval):
  90.         return not inval
  91.  
  92.     def Test2(self, inval):
  93.         return inval
  94.  
  95.     def Test3(self, inval):
  96.         raise COMException(hresult=winerror.E_NOTIMPL)
  97.  
  98.     def Test4(self, inval):
  99.         raise COMException(hresult=winerror.E_NOTIMPL)
  100.  
  101.     def Test5(self, inout):
  102.         if inout == constants.TestAttr1:
  103.             return constants.TestAttr1_1
  104.         elif inout == constants.TestAttr1_1:
  105.             return constants.TestAttr1
  106.         else:
  107.             return -1
  108.  
  109.     def TestOptionals(self, strArg='def', sval=0, lval=1, dval=3.1400001049041748):
  110.         raise COMException(hresult=winerror.E_NOTIMPL)
  111.  
  112.     def TestOptionals2(self, dval, strval='', sval=1):
  113.         raise COMException(hresult=winerror.E_NOTIMPL)
  114.  
  115.     def CheckVariantSafeArray(self, data):
  116.         return 1
  117.  
  118.     def LongProp(self):
  119.         return self.intval
  120.     def SetLongProp(self, val):
  121.         self.intval = val
  122.     def IntProp(self):
  123.         return self.intval
  124.     def SetIntProp(self, val):
  125.         self.intval = val
  126.  
  127. if __name__ == '__main__':
  128.     import win32com.server.register
  129.     win32com.server.register.UseCommandLine(PyCOMTest)
  130.