Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/test
Modified Files:
Tag: py3k
errorSemantics.py policySemantics.py testAXScript.py
testArrays.py testClipboard.py testDictionary.py
testExplorer.py testMSOffice.py testPersist.py testPippo.py
testPyComTest.py testServers.py testShell.py testall.py
testvb.py util.py
Log Message:
Merge various changes from trunk and py3k-integration bzr branch
Index: testPippo.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPippo.py,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** testPippo.py 3 Jun 2007 13:27:02 -0000 1.4
--- testPippo.py 26 Nov 2008 07:17:39 -0000 1.4.2.1
***************
*** 7,13 ****
class PippoTester(unittest.TestCase):
def setUp(self):
! # register the server
! import pippo_server
! pippo_server.main([pippo_server.__file__])
# create it.
self.object = Dispatch("Python.Test.Pippo")
--- 7,13 ----
class PippoTester(unittest.TestCase):
def setUp(self):
! from win32com.test.util import RegisterPythonServer
! from win32com.test import pippo_server
! RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo")
# create it.
self.object = Dispatch("Python.Test.Pippo")
Index: testArrays.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testArrays.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** testArrays.py 4 May 2004 07:03:04 -0000 1.2
--- testArrays.py 26 Nov 2008 07:17:39 -0000 1.2.4.1
***************
*** 2,6 ****
# arrays patch.
from win32com.client import gencache
! import util
import unittest
--- 2,6 ----
# arrays patch.
from win32com.client import gencache
! from win32com.test import util
import unittest
Index: testServers.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testServers.py,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -d -r1.5 -r1.5.4.1
*** testServers.py 4 May 2004 07:01:44 -0000 1.5
--- testServers.py 26 Nov 2008 07:17:39 -0000 1.5.4.1
***************
*** 11,17 ****
def setUp(self):
# Ensure the correct version registered.
! from win32com.servers.interp import Interpreter
! import win32com.server.register
! win32com.server.register.RegisterClasses(Interpreter, quiet=1)
def _testInterp(self, interp):
--- 11,17 ----
def setUp(self):
# Ensure the correct version registered.
! from win32com.test.util import RegisterPythonServer
! from win32com.servers import interp
! RegisterPythonServer(interp.__file__, "Python.Interpreter")
def _testInterp(self, interp):
Index: policySemantics.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/policySemantics.py,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -C2 -d -r1.4 -r1.4.4.1
*** policySemantics.py 10 Nov 2003 00:49:29 -0000 1.4
--- policySemantics.py 26 Nov 2008 07:17:39 -0000 1.4.4.1
***************
*** 23,27 ****
def _Evaluate(self):
# return the sum
! return reduce(lambda a,b: a+b, self.list, 0)
def In(self, value):
return value in self.list
--- 23,27 ----
def _Evaluate(self):
# return the sum
! return sum(self.list)
def In(self, value):
return value in self.list
Index: testPyComTest.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -C2 -d -r1.32 -r1.32.2.1
*** testPyComTest.py 1 Jul 2008 00:11:57 -0000 1.32
--- testPyComTest.py 26 Nov 2008 07:17:39 -0000 1.32.2.1
***************
*** 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
--- 15,20 ----
# This test uses a Python implemented COM server - ensure correctly registered.
! RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"),
! "Python.Test.PyCOMTest")
from win32com.client import gencache
Index: util.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/util.py,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -C2 -d -r1.9.2.1 -r1.9.2.2
*** util.py 11 Nov 2008 01:04:19 -0000 1.9.2.1
--- util.py 26 Nov 2008 07:17:39 -0000 1.9.2.2
***************
*** 1,3 ****
--- 1,4 ----
import sys, os
+ import winreg as _winreg
import win32api
import tempfile
***************
*** 14,18 ****
# Ensure no lingering exceptions - Python should have zero outstanding
# COM objects
! sys.exc_clear()
c = _GetInterfaceCount()
if c:
--- 15,22 ----
# Ensure no lingering exceptions - Python should have zero outstanding
# COM objects
! try:
! sys.exc_clear()
! except AttributeError:
! pass # py3k
c = _GetInterfaceCount()
if c:
***************
*** 22,26 ****
print "Warning - %d com gateway objects still alive" % c
! def RegisterPythonServer(filename, verbose=0):
cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename)
if verbose:
--- 26,77 ----
print "Warning - %d com gateway objects still alive" % c
! def RegisterPythonServer(filename, progids=None, verbose=0):
! if progids:
! if isinstance(progids, basestring):
! progids = [progids]
! # we know the CLSIDs we need, but we might not be an admin user
! # and otherwise unable to register them. So as long as the progids
! # exist and the DLL points at our version, assume it already is.
! why_not = None
! for progid in progids:
! try:
! clsid = pythoncom.MakeIID(progid)
! except pythoncom.com_error:
! # no progid - not registered.
! break
! # have a CLSID - open it.
! try:
! HKCR = _winreg.HKEY_CLASSES_ROOT
! hk = _winreg.OpenKey(HKCR, "CLSID\\%s" % clsid)
! dll = _winreg.QueryValue(hk, "InprocServer32")
! except WindowsError:
! # no CLSID or InProcServer32 - not good!
! break
! if os.path.basename(dll) != os.path.basename(pythoncom.__file__):
! why_not = "%r is registered against a different Python version (%s)" % (progid, dll)
! break
! else:
! #print "Skipping registration of '%s' - already registered" % filename
! return
! # needs registration - see if its likely!
! try:
! from win32com.shell.shell import IsUserAnAdmin
! except ImportError:
! print "Can't import win32com.shell - no idea if you are an admin or not?"
! is_admin = False
! else:
! try:
! is_admin = IsUserAnAdmin()
! except pythoncom.com_error:
! # old, less-secure OS - assume *is* admin.
! is_admin = True
! if not is_admin:
! msg = "%r isn't registered, but I'm not an administrator who can register it." % progids[0]
! if why_not:
! msg += "\n(registration check failed as %s)" % why_not
! # throw a normal "class not registered" exception - we don't report
! # them the same way as "real" errors.
! raise pythoncom.com_error(winerror.CO_E_CLASSSTRING, msg, None, -1)
! # so theoretically we are able to register it.
cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename)
if verbose:
***************
*** 64,68 ****
func(*args, **kw)
except pythoncom.com_error, details:
! if details[0]==hresult:
return
testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult)
--- 115,119 ----
func(*args, **kw)
except pythoncom.com_error, details:
! if details.hresult==hresult:
return
testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult)
***************
*** 176,179 ****
--- 227,260 ----
return test
+ class TestResult(unittest._TextTestResult):
+ def __init__(self, *args, **kw):
+ super(TestResult, self).__init__(*args, **kw)
+ self.num_invalid_clsid = 0
+
+ def addError(self, test, err):
+ """Called when an error has occurred. 'err' is a tuple of values as
+ returned by sys.exc_info().
+ """
+ if isinstance(err[1], pythoncom.com_error) and \
+ err[1].hresult==winerror.CO_E_CLASSSTRING:
+ self.num_invalid_clsid += 1
+ if self.showAll:
+ self.stream.writeln("SKIP")
+ elif self.dots:
+ self.stream.write('S')
+ self.stream.flush()
+ return
+ super(TestResult, self).addError(test, err)
+
+ def printErrors(self):
+ super(TestResult, self).printErrors()
+ if self.num_invalid_clsid:
+ self.stream.writeln("SKIPPED: %d tests due to missing COM objects used for testing" %
+ self.num_invalid_clsid)
+
+ class TestRunner(unittest.TextTestRunner):
+ def _makeResult(self):
+ return TestResult(self.stream, self.descriptions, self.verbosity)
+
# Utilities to set the win32com logger to something what just captures
# records written and doesn't print them.
***************
*** 244,249 ****
def testmain(*args, **kw):
new_kw = kw.copy()
! if not new_kw.has_key('testLoader'):
new_kw['testLoader'] = TestLoader()
unittest.main(*args, **new_kw)
CheckClean()
--- 325,332 ----
def testmain(*args, **kw):
new_kw = kw.copy()
! if 'testLoader' not in new_kw:
new_kw['testLoader'] = TestLoader()
+ if 'testRunner' not in new_kw:
+ new_kw['testRunner'] = TestRunner()
unittest.main(*args, **new_kw)
CheckClean()
Index: testShell.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v
retrieving revision 1.10.4.1
retrieving revision 1.10.4.2
diff -C2 -d -r1.10.4.1 -r1.10.4.2
*** testShell.py 13 Sep 2008 14:40:54 -0000 1.10.4.1
--- testShell.py 26 Nov 2008 07:17:39 -0000 1.10.4.2
***************
*** 4,7 ****
--- 4,12 ----
import copy
+ try:
+ sys_maxsize = sys.maxsize # 2.6 and later - maxsize != maxint on 64bits
+ except AttributeError:
+ sys_maxsize = sys.maxint
+
import win32con
import pythoncom
***************
*** 18,23 ****
shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile)
! for base_name in os.listdir(desktop):
! name = os.path.join(desktop, base_name)
try:
persistFile.Load(name,STGM_READ)
--- 23,30 ----
shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile)
! names = [os.path.join(desktop, n) for n in os.listdir(desktop)]
! programs = str(shell.SHGetSpecialFolderPath(0, CSIDL_PROGRAMS))
! names.extend([os.path.join(programs, n) for n in os.listdir(programs)])
! for name in names:
try:
persistFile.Load(name,STGM_READ)
***************
*** 31,35 ****
if num == 0:
# This isn't a fatal error, but is unlikely.
! print ("Could not find any links on your desktop, which is unusual")
def testShellFolder(self):
--- 38,42 ----
if num == 0:
# This isn't a fatal error, but is unlikely.
! print ("Could not find any links on your desktop or programs dir, which is unusual")
def testShellFolder(self):
***************
*** 130,134 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1)
self._testRT(d)
--- 137,141 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1)
self._testRT(d)
***************
*** 145,149 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1),
dict(cFileName="foo2.txt",
sizel=(1,2),
--- 152,156 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1),
dict(cFileName="foo2.txt",
sizel=(1,2),
***************
*** 153,158 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1),
! dict(cFileName="foo\xa9.txt",
sizel=(1,2),
pointl=(3,4),
--- 160,165 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1),
! dict(cFileName=u"foo\xa9.txt",
sizel=(1,2),
pointl=(3,4),
***************
*** 161,165 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1),
]
s = shell.FILEGROUPDESCRIPTORAsString(d, 1)
--- 168,172 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1),
]
s = shell.FILEGROUPDESCRIPTORAsString(d, 1)
Index: testMSOffice.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testMSOffice.py,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -C2 -d -r1.7 -r1.7.4.1
*** testMSOffice.py 18 Nov 2002 11:20:06 -0000 1.7
--- testMSOffice.py 26 Nov 2008 07:17:39 -0000 1.7.4.1
***************
*** 21,25 ****
try:
# NOTE - using "client.Dispatch" would return an msword8.py instance!
! print "Starting Word 8 for dynamic test"
word = win32com.client.dynamic.Dispatch("Word.Application")
TestWord8(word)
--- 21,25 ----
try:
# NOTE - using "client.Dispatch" would return an msword8.py instance!
! print ("Starting Word 8 for dynamic test")
word = win32com.client.dynamic.Dispatch("Word.Application")
TestWord8(word)
***************
*** 27,31 ****
word = None
# Now we will test Dispatch without the new "lazy" capabilities
! print "Starting Word 8 for non-lazy dynamic test"
dispatch = win32com.client.dynamic._GetGoodDispatch("Word.Application")
typeinfo = dispatch.GetTypeInfo()
--- 27,31 ----
word = None
# Now we will test Dispatch without the new "lazy" capabilities
! print ("Starting Word 8 for non-lazy dynamic test")
dispatch = win32com.client.dynamic._GetGoodDispatch("Word.Application")
typeinfo = dispatch.GetTypeInfo()
***************
*** 37,45 ****
except pythoncom.com_error:
! print "Starting Word 7 for dynamic test"
word = win32com.client.Dispatch("Word.Basic")
TestWord7(word)
! print "Starting MSWord for generated test"
from win32com.client import gencache
word = gencache.EnsureDispatch("Word.Application.8")
--- 37,45 ----
except pythoncom.com_error:
! print ("Starting Word 7 for dynamic test")
word = win32com.client.Dispatch("Word.Basic")
TestWord7(word)
! print ("Starting MSWord for generated test")
from win32com.client import gencache
word = gencache.EnsureDispatch("Word.Application.8")
***************
*** 82,86 ****
import win32com.test.Generated4Test.msword8
except ImportError:
! print "Can not do old style test"
--- 82,86 ----
import win32com.test.Generated4Test.msword8
except ImportError:
! print ("Can not do old style test")
***************
*** 135,166 ****
def TestAll():
! try:
! TestWord()
!
! print "Starting Excel for Dynamic test..."
! xl = win32com.client.dynamic.Dispatch("Excel.Application")
! TextExcel(xl)
! try:
! print "Starting Excel 8 for generated excel8.py test..."
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1)
! xl = win32com.client.Dispatch("Excel.Application")
! TextExcel(xl)
! except ImportError:
! print "Could not import the generated Excel 97 wrapper"
! try:
! import xl5en32
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0)
! xl = win32com.client.Dispatch("Excel.Application.5")
! print "Starting Excel 95 for makepy test..."
! TextExcel(xl)
! except ImportError:
! print "Could not import the generated Excel 95 wrapper"
! except KeyboardInterrupt:
! print "*** Interrupted MSOffice test ***"
! except:
! traceback.print_exc()
if __name__=='__main__':
--- 135,160 ----
def TestAll():
! TestWord()
! print ("Starting Excel for Dynamic test...")
! xl = win32com.client.dynamic.Dispatch("Excel.Application")
! TextExcel(xl)
! try:
! print ("Starting Excel 8 for generated excel8.py test...")
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1)
! xl = win32com.client.Dispatch("Excel.Application")
! TextExcel(xl)
! except ImportError:
! print ("Could not import the generated Excel 97 wrapper")
! try:
! import xl5en32
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0)
! xl = win32com.client.Dispatch("Excel.Application.5")
! print ("Starting Excel 95 for makepy test...")
! TextExcel(xl)
! except ImportError:
! print ("Could not import the generated Excel 95 wrapper")
if __name__=='__main__':
Index: errorSemantics.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/errorSemantics.py,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -d -r1.6 -r1.6.4.1
*** errorSemantics.py 7 Sep 2004 02:10:49 -0000 1.6
--- errorSemantics.py 26 Nov 2008 07:17:39 -0000 1.6.4.1
***************
*** 32,36 ****
def Commit(self, flags):
! raise "foo"
def test():
--- 32,36 ----
def Commit(self, flags):
! raise Exception("foo")
def test():
***************
*** 39,46 ****
try:
com_server.Clone()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.E_UNEXPECTED:
raise error("Calling the object natively did not yield the correct scode", com_exc)
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
--- 39,47 ----
try:
com_server.Clone()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.E_UNEXPECTED:
raise error("Calling the object natively did not yield the correct scode", com_exc)
+ exc = com_exc.excepinfo
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
***************
*** 54,62 ****
finally:
cap.release()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.E_FAIL:
raise error("The hresult was not E_FAIL for an internal error", com_exc)
! if exc[1] != "Python COM Server Internal Error":
raise error("The description in the exception tuple did not yield the correct string", com_exc)
# Check we saw a traceback in stderr
--- 55,63 ----
finally:
cap.release()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.E_FAIL:
raise error("The hresult was not E_FAIL for an internal error", com_exc)
! if com_exc.excepinfo[1] != "Python COM Server Internal Error":
raise error("The description in the exception tuple did not yield the correct string", com_exc)
# Check we saw a traceback in stderr
***************
*** 68,75 ****
try:
com_server.Clone()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
--- 69,77 ----
try:
com_server.Clone()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
+ exc = com_exc.excepinfo
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
***************
*** 84,91 ****
finally:
cap.release()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
if not exc or exc[-1] != winerror.E_FAIL:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
--- 86,94 ----
finally:
cap.release()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
+ exc = com_exc.excepinfo
if not exc or exc[-1] != winerror.E_FAIL:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
Index: testvb.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testvb.py,v
retrieving revision 1.20
retrieving revision 1.20.4.1
diff -C2 -d -r1.20 -r1.20.4.1
*** testvb.py 21 Nov 2006 06:56:04 -0000 1.20
--- testvb.py 26 Nov 2008 07:17:39 -0000 1.20.4.1
***************
*** 8,29 ****
from win32com.server.util import NewCollection, wrap
import string
! import util
!
! importMsg = """\
! **** VB Test harness is not installed ***
! This test requires a VB test program to be built and installed
! on this PC.
! """
!
! ### NOTE: VB SUCKS!
! ### If you delete the DLL built by VB, then reopen VB
! ### to rebuild the DLL, it loses the IID of the object!!!
! ### So I will try to avoid this in the future :-)
!
! # Import the type library for the test module.
! try:
! win32com.client.gencache.EnsureDispatch("PyCOMVBTest.Tester")
! except pythoncom.com_error:
! raise RuntimeError, importMsg
import traceback
--- 8,12 ----
from win32com.server.util import NewCollection, wrap
import string
! from win32com.test import util
import traceback
***************
*** 34,38 ****
## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
! error = "VB Test Error"
# Set up a COM object that VB will do some callbacks on. This is used
--- 17,21 ----
## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
! error = RuntimeError
# Set up a COM object that VB will do some callbacks on. This is used
***************
*** 78,100 ****
vbtest.LongProperty = -1
if vbtest.LongProperty != -1:
! raise error, "Could not set the long property correctly."
vbtest.IntProperty = 10
if vbtest.IntProperty != 10:
! raise error, "Could not set the integer property correctly."
vbtest.VariantProperty = 10
if vbtest.VariantProperty != 10:
! raise error, "Could not set the variant integer property correctly."
vbtest.VariantProperty = buffer('raw\0data')
if vbtest.VariantProperty != buffer('raw\0data'):
! raise error, "Could not set the variant buffer property correctly."
vbtest.StringProperty = "Hello from Python"
if vbtest.StringProperty != "Hello from Python":
! raise error, "Could not set the string property correctly."
vbtest.VariantProperty = "Hello from Python"
if vbtest.VariantProperty != "Hello from Python":
! raise error, "Could not set the variant string property correctly."
vbtest.VariantProperty = (1.0, 2.0, 3.0)
if vbtest.VariantProperty != (1.0, 2.0, 3.0):
! raise error, "Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,)
TestArrays(vbtest, bUseGenerated)
--- 61,83 ----
vbtest.LongProperty = -1
if vbtest.LongProperty != -1:
! raise error("Could not set the long property correctly.")
vbtest.IntProperty = 10
if vbtest.IntProperty != 10:
! raise error("Could not set the integer property correctly.")
vbtest.VariantProperty = 10
if vbtest.VariantProperty != 10:
! raise error("Could not set the variant integer property correctly.")
vbtest.VariantProperty = buffer('raw\0data')
if vbtest.VariantProperty != buffer('raw\0data'):
! raise error("Could not set the variant buffer property correctly.")
vbtest.StringProperty = "Hello from Python"
if vbtest.StringProperty != "Hello from Python":
! raise error("Could not set the string property correctly.")
vbtest.VariantProperty = "Hello from Python"
if vbtest.VariantProperty != "Hello from Python":
! raise error("Could not set the variant string property correctly.")
vbtest.VariantProperty = (1.0, 2.0, 3.0)
if vbtest.VariantProperty != (1.0, 2.0, 3.0):
! raise error("Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,))
TestArrays(vbtest, bUseGenerated)
***************
*** 113,117 ****
vbtest.VariantPutref = vbtest
if vbtest.VariantPutref._oleobj_!= vbtest._oleobj_:
! raise error, "Could not set the VariantPutref property correctly."
# Cant test further types for this VariantPutref, as only
# COM objects can be stored ByRef.
--- 96,100 ----
vbtest.VariantPutref = vbtest
if vbtest.VariantPutref._oleobj_!= vbtest._oleobj_:
! raise error("Could not set the VariantPutref property correctly.")
# Cant test further types for this VariantPutref, as only
# COM objects can be stored ByRef.
***************
*** 122,131 ****
# vbtest.CollectionProperty = NewCollection((1,2,"3", "Four"))
# if vbtest.CollectionProperty != (1,2,"3", "Four"):
! # raise error, "Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty)
# These are sub's that have a single byref param
# Result should be just the byref.
if vbtest.IncrementIntegerParam(1) != 2:
! raise error, "Could not pass an integer byref"
# Sigh - we cant have *both* "ommited byref" and optional args
--- 105,114 ----
# vbtest.CollectionProperty = NewCollection((1,2,"3", "Four"))
# if vbtest.CollectionProperty != (1,2,"3", "Four"):
! # raise error("Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty))
# These are sub's that have a single byref param
# Result should be just the byref.
if vbtest.IncrementIntegerParam(1) != 2:
! raise error("Could not pass an integer byref")
# Sigh - we cant have *both* "ommited byref" and optional args
***************
*** 133,143 ****
# rather than simply all byrefs working as optional.
# if vbtest.IncrementIntegerParam() != 1:
! # raise error, "Could not pass an omitted integer byref"
if vbtest.IncrementVariantParam(1) != 2:
! raise error, "Could not pass an int VARIANT byref:"+str(vbtest.IncrementVariantParam(1))
if vbtest.IncrementVariantParam(1.5) != 2.5:
! raise error, "Could not pass a float VARIANT byref"
# Can't test IncrementVariantParam with the param omitted as it
--- 116...
[truncated message content] |