Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19471/win32com/test
Modified Files:
errorSemantics.py pippo_server.py policySemantics.py
testAccess.py testCollections.py testDictionary.py
testDynamic.py testExplorer.py testGIT.py testMSOffice.py
testMSOfficeEvents.py testNetscape.py testPyComTest.py
testStreams.py testall.py util.py
Log Message:
modernize syntax: all remaining raise statements in com/* upgraded
Index: testMSOfficeEvents.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testMSOfficeEvents.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** testMSOfficeEvents.py 18 Mar 2003 23:00:35 -0000 1.4
--- testMSOfficeEvents.py 26 Nov 2008 08:52:32 -0000 1.5
***************
*** 12,20 ****
def OnNewWorkbook(self, wb):
if type(wb) != types.InstanceType:
! raise RuntimeError, "The transformer doesnt appear to have translated this for us!"
self.seen_events["OnNewWorkbook"] = None
def OnWindowActivate(self, wb, wn):
if type(wb) != types.InstanceType or type(wn) != types.InstanceType:
! raise RuntimeError, "The transformer doesnt appear to have translated this for us!"
self.seen_events["OnWindowActivate"] = None
def OnWindowDeactivate(self, wb, wn):
--- 12,20 ----
def OnNewWorkbook(self, wb):
if type(wb) != types.InstanceType:
! raise RuntimeError("The transformer doesnt appear to have translated this for us!")
self.seen_events["OnNewWorkbook"] = None
def OnWindowActivate(self, wb, wn):
if type(wb) != types.InstanceType or type(wn) != types.InstanceType:
! raise RuntimeError("The transformer doesnt appear to have translated this for us!")
self.seen_events["OnWindowActivate"] = None
def OnWindowDeactivate(self, wb, wn):
Index: policySemantics.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/policySemantics.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** policySemantics.py 26 Nov 2008 01:16:13 -0000 1.5
--- policySemantics.py 26 Nov 2008 08:52:32 -0000 1.6
***************
*** 50,54 ****
dispids.sort()
if dispids <> [pythoncom.DISPID_EVALUATE, pythoncom.DISPID_NEWENUM, 10, 11, 1000]:
! raise Error, "Got back the wrong dispids: %s" % dispids
def SemanticTest(ob):
--- 50,54 ----
dispids.sort()
if dispids <> [pythoncom.DISPID_EVALUATE, pythoncom.DISPID_NEWENUM, 10, 11, 1000]:
! raise Error("Got back the wrong dispids: %s" % dispids)
def SemanticTest(ob):
***************
*** 59,63 ****
# invoke _value_
if ob() != (1,2,3):
! raise Error, "Bad result - got %s" % (`ob()`)
dispob = ob._oleobj_
--- 59,63 ----
# invoke _value_
if ob() != (1,2,3):
! raise Error("Bad result - got %s" % (`ob()`))
dispob = ob._oleobj_
***************
*** 65,69 ****
rc = dispob.Invoke(pythoncom.DISPID_EVALUATE, 0, pythoncom.DISPATCH_METHOD|pythoncom.DISPATCH_PROPERTYGET, 1)
if rc != 6:
! raise Error, "Evaluate returned", rc
--- 65,69 ----
rc = dispob.Invoke(pythoncom.DISPID_EVALUATE, 0, pythoncom.DISPATCH_METHOD|pythoncom.DISPATCH_PROPERTYGET, 1)
if rc != 6:
! raise Error("Evaluate returned").with_traceback(rc)
Index: testAccess.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testAccess.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** testAccess.py 25 Apr 2004 03:58:12 -0000 1.6
--- testAccess.py 26 Nov 2008 08:52:32 -0000 1.7
***************
*** 88,99 ****
tab1.MoveLast()
if tab1.Fields("First Name").Value != "Second":
! raise RuntimeError, "Unexpected record is last - makes bookmark test pointless!"
tab1.Bookmark = bk
if tab1.Bookmark != bk:
! raise RuntimeError, "The bookmark data is not the same"
if tab1.Fields("First Name").Value != "Mark":
! raise RuntimeError, "The bookmark did not reset the record pointer correctly"
return dbname
--- 88,99 ----
tab1.MoveLast()
if tab1.Fields("First Name").Value != "Second":
! raise RuntimeError("Unexpected record is last - makes bookmark test pointless!")
tab1.Bookmark = bk
if tab1.Bookmark != bk:
! raise RuntimeError("The bookmark data is not the same")
if tab1.Fields("First Name").Value != "Mark":
! raise RuntimeError("The bookmark did not reset the record pointer correctly")
return dbname
Index: testPyComTest.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** testPyComTest.py 26 Nov 2008 01:27:40 -0000 1.34
--- testPyComTest.py 26 Nov 2008 08:52:32 -0000 1.35
***************
*** 24,28 ****
print "The PyCOMTest module can not be located or generated."
print importMsg
! raise RuntimeError, importMsg
# We had a bg where RegisterInterfaces would fail if gencache had
--- 24,28 ----
print "The PyCOMTest module can not be located or generated."
print importMsg
! raise RuntimeError(importMsg)
# We had a bg where RegisterInterfaces would fail if gencache had
***************
*** 49,53 ****
rc = apply(fn, args)
if rc != result:
! raise error, "%s failed - result not %r but %r" % (pref, result, rc)
def TestConstant(constName, pyConst):
--- 49,53 ----
rc = apply(fn, args)
if rc != result:
! raise error("%s failed - result not %r but %r" % (pref, result, rc))
def TestConstant(constName, pyConst):
***************
*** 55,61 ****
comConst = getattr(constants, constName)
except:
! raise error, "Constant %s missing" % (constName,)
if comConst != pyConst:
! raise error, "Constant value wrong for %s - got %s, wanted %s" % (constName, comConst, pyConst)
# Simple handler class. This demo only fires one event.
--- 55,61 ----
comConst = getattr(constants, constName)
except:
! raise error("Constant %s missing" % (constName,))
if comConst != pyConst:
! raise error("Constant value wrong for %s - got %s, wanted %s" % (constName, comConst, pyConst))
# Simple handler class. This demo only fires one event.
***************
*** 100,116 ****
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
print rc
! raise error, "Did not get the optional values correctly"
rc = o.TestOptionals("Hi", 2, 3, 1.1)
if rc[:-1] != ("Hi", 2, 3) or abs(rc[-1]-1.1)>.01:
print rc
! raise error, "Did not get the specified optional values correctly"
rc = o.TestOptionals2(0)
if rc != (0, "", 1):
print rc
! raise error, "Did not get the optional2 values correctly"
rc = o.TestOptionals2(1.1, "Hi", 2)
if rc[1:] != ("Hi", 2) or abs(rc[0]-1.1)>.01:
print rc
! raise error, "Did not get the specified optional2 values correctly"
# if verbose: print "Testing structs"
--- 100,116 ----
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
print rc
! raise error("Did not get the optional values correctly")
rc = o.TestOptionals("Hi", 2, 3, 1.1)
if rc[:-1] != ("Hi", 2, 3) or abs(rc[-1]-1.1)>.01:
print rc
! raise error("Did not get the specified optional values correctly")
rc = o.TestOptionals2(0)
if rc != (0, "", 1):
print rc
! raise error("Did not get the optional2 values correctly")
rc = o.TestOptionals2(1.1, "Hi", 2)
if rc[1:] != ("Hi", 2) or abs(rc[0]-1.1)>.01:
print rc
! raise error("Did not get the specified optional2 values correctly")
# if verbose: print "Testing structs"
***************
*** 129,136 ****
o.LongProp = 3
if o.LongProp != 3 or o.IntProp != 3:
! raise error, "Property value wrong - got %d/%d" % (o.LongProp,o.IntProp)
o.LongProp = o.IntProp = -3
if o.LongProp != -3 or o.IntProp != -3:
! raise error, "Property value wrong - got %d/%d" % (o.LongProp,o.IntProp)
# This number fits in an unsigned long. Attempting to set it to a normal
# long will involve overflow, which is to be expected. But we do
--- 129,136 ----
o.LongProp = 3
if o.LongProp != 3 or o.IntProp != 3:
! raise error("Property value wrong - got %d/%d" % (o.LongProp,o.IntProp))
o.LongProp = o.IntProp = -3
if o.LongProp != -3 or o.IntProp != -3:
! raise error("Property value wrong - got %d/%d" % (o.LongProp,o.IntProp))
# This number fits in an unsigned long. Attempting to set it to a normal
# long will involve overflow, which is to be expected. But we do
***************
*** 139,147 ****
o.ULongProp = check
if o.ULongProp != check:
! raise error, "Property value wrong - got %d (expected %d)" % (o.ULongProp, check)
# currency.
pythoncom.__future_currency__ = 1
if o.CurrencyProp != 0:
! raise error, "Expecting 0, got %r" % (o.CurrencyProp,)
try:
import decimal
--- 139,147 ----
o.ULongProp = check
if o.ULongProp != check:
! raise error("Property value wrong - got %d (expected %d)" % (o.ULongProp, check))
# currency.
pythoncom.__future_currency__ = 1
if o.CurrencyProp != 0:
! raise error("Expecting 0, got %r" % (o.CurrencyProp,))
try:
import decimal
***************
*** 150,154 ****
o.CurrencyProp = decimal.Decimal("1234.5678")
if o.CurrencyProp != decimal.Decimal("1234.5678"):
! raise error, "got %r" % (o.CurrencyProp,)
v1 = decimal.Decimal("1234.5678")
# can't do "DoubleCurrencyByVal" in dynamic files.
--- 150,154 ----
o.CurrencyProp = decimal.Decimal("1234.5678")
if o.CurrencyProp != decimal.Decimal("1234.5678"):
! raise error("got %r" % (o.CurrencyProp,))
v1 = decimal.Decimal("1234.5678")
# can't do "DoubleCurrencyByVal" in dynamic files.
***************
*** 183,187 ****
if type(i1) != types.InstanceType or type(i2) != types.InstanceType:
# Yay - is now an instance returned!
! raise error, "GetMultipleInterfaces did not return instances - got '%s', '%s'" % (i1, i2)
del i1
del i2
--- 183,187 ----
if type(i1) != types.InstanceType or type(i2) != types.InstanceType:
# Yay - is now an instance returned!
! raise error("GetMultipleInterfaces did not return instances - got '%s', '%s'" % (i1, i2))
del i1
del i2
***************
*** 191,244 ****
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
print rc
! raise error, "Did not get the optional values correctly"
rc = o.TestOptionals("Hi", 2, 3, 1.1)
if rc[:-1] != ("Hi", 2, 3) or abs(rc[-1]-1.1)>.01:
print rc
! raise error, "Did not get the specified optional values correctly"
rc = o.TestOptionals2(0)
if rc != (0, "", 1):
print rc
! raise error, "Did not get the optional2 values correctly"
rc = o.TestOptionals2(1.1, "Hi", 2)
if rc[1:] != ("Hi", 2) or abs(rc[0]-1.1)>.01:
print rc
! raise error, "Did not get the specified optional2 values correctly"
progress("Checking var args")
o.SetVarArgs("Hi", "There", "From", "Python", 1)
if o.GetLastVarArgs() != ("Hi", "There", "From", "Python", 1):
! raise error, "VarArgs failed -" + str(o.GetLastVarArgs())
progress("Checking getting/passing IUnknown")
if o.GetSetUnknown(o) != o:
! raise error, "GetSetUnknown failed"
progress("Checking getting/passing IDispatch")
if type(o.GetSetDispatch(o)) !=types.InstanceType:
! raise error, "GetSetDispatch failed"
progress("Checking getting/passing IDispatch of known type")
if o.GetSetInterface(o).__class__ != o.__class__:
! raise error, "GetSetDispatch failed"
if o.GetSetVariant(4) != 4:
! raise error, "GetSetVariant (int) failed"
if o.GetSetVariant("foo") != "foo":
! raise error, "GetSetVariant (str) failed"
if o.GetSetVariant(o) != o:
! raise error, "GetSetVariant (dispatch) failed"
for l in sys.maxint, sys.maxint+1, 1 << 65L:
if o.GetSetVariant(l) != l:
! raise error, "GetSetVariant (long) failed"
if o.TestByRefVariant(2) != 4:
! raise error, "TestByRefVariant failed"
if o.TestByRefString("Foo") != "FooFoo":
! raise error, "TestByRefString failed"
# Pass some non-sequence objects to our array decoder, and watch it fail.
try:
o.SetVariantSafeArray("foo")
! raise error, "Expected a type error"
except TypeError:
pass
try:
o.SetVariantSafeArray(666)
! raise error, "Expected a type error"
except TypeError:
pass
--- 191,244 ----
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
print rc
! raise error("Did not get the optional values correctly")
rc = o.TestOptionals("Hi", 2, 3, 1.1)
if rc[:-1] != ("Hi", 2, 3) or abs(rc[-1]-1.1)>.01:
print rc
! raise error("Did not get the specified optional values correctly")
rc = o.TestOptionals2(0)
if rc != (0, "", 1):
print rc
! raise error("Did not get the optional2 values correctly")
rc = o.TestOptionals2(1.1, "Hi", 2)
if rc[1:] != ("Hi", 2) or abs(rc[0]-1.1)>.01:
print rc
! raise error("Did not get the specified optional2 values correctly")
progress("Checking var args")
o.SetVarArgs("Hi", "There", "From", "Python", 1)
if o.GetLastVarArgs() != ("Hi", "There", "From", "Python", 1):
! raise error("VarArgs failed -" + str(o.GetLastVarArgs()))
progress("Checking getting/passing IUnknown")
if o.GetSetUnknown(o) != o:
! raise error("GetSetUnknown failed")
progress("Checking getting/passing IDispatch")
if type(o.GetSetDispatch(o)) !=types.InstanceType:
! raise error("GetSetDispatch failed")
progress("Checking getting/passing IDispatch of known type")
if o.GetSetInterface(o).__class__ != o.__class__:
! raise error("GetSetDispatch failed")
if o.GetSetVariant(4) != 4:
! raise error("GetSetVariant (int) failed")
if o.GetSetVariant("foo") != "foo":
! raise error("GetSetVariant (str) failed")
if o.GetSetVariant(o) != o:
! raise error("GetSetVariant (dispatch) failed")
for l in sys.maxint, sys.maxint+1, 1 << 65L:
if o.GetSetVariant(l) != l:
! raise error("GetSetVariant (long) failed")
if o.TestByRefVariant(2) != 4:
! raise error("TestByRefVariant failed")
if o.TestByRefString("Foo") != "FooFoo":
! raise error("TestByRefString failed")
# Pass some non-sequence objects to our array decoder, and watch it fail.
try:
o.SetVariantSafeArray("foo")
! raise error("Expected a type error")
except TypeError:
pass
try:
o.SetVariantSafeArray(666)
! raise error("Expected a type error")
except TypeError:
pass
***************
*** 297,315 ****
o.LongProp = 3
if o.LongProp != 3 or o.IntProp != 3:
! raise error, "Property value wrong - got %d/%d" % (o.LongProp,o.IntProp)
o.LongProp = o.IntProp = -3
if o.LongProp != -3 or o.IntProp != -3:
! raise error, "Property value wrong - got %d/%d" % (o.LongProp,o.IntProp)
check = 3 *10 **9
o.ULongProp = check
if o.ULongProp != check:
! raise error, "Property value wrong - got %d (expected %d)" % (o.ULongProp, check)
# currency.
pythoncom.__future_currency__ = 1
if o.CurrencyProp != 0:
! raise error, "Expecting 0, got %r" % (o.CurrencyProp,)
try:
import decimal
--- 297,315 ----
o.LongProp = 3
if o.LongProp != 3 or o.IntProp != 3:
! raise error("Property value wrong - got %d/%d" % (o.LongProp,o.IntProp))
o.LongProp = o.IntProp = -3
if o.LongProp != -3 or o.IntProp != -3:
! raise error("Property value wrong - got %d/%d" % (o.LongProp,o.IntProp))
check = 3 *10 **9
o.ULongProp = check
if o.ULongProp != check:
! raise error("Property value wrong - got %d (expected %d)" % (o.ULongProp, check))
# currency.
pythoncom.__future_currency__ = 1
if o.CurrencyProp != 0:
! raise error("Expecting 0, got %r" % (o.CurrencyProp,))
try:
import decimal
***************
*** 319,323 ****
o.CurrencyProp = decimal.Decimal(val)
if o.CurrencyProp != decimal.Decimal(val):
! raise error, "%s got %r" % (val, o.CurrencyProp)
v1 = decimal.Decimal("1234.5678")
TestApplyResult(o.DoubleCurrency, (v1,), v1*2)
--- 319,323 ----
o.CurrencyProp = decimal.Decimal(val)
if o.CurrencyProp != decimal.Decimal(val):
! raise error("%s got %r" % (val, o.CurrencyProp))
v1 = decimal.Decimal("1234.5678")
TestApplyResult(o.DoubleCurrency, (v1,), v1*2)
***************
*** 328,332 ****
o.SetParamProp(0, 1)
if o.ParamProp(0) != 1:
! raise RuntimeError, o.paramProp(0)
# Do the connection point thing...
--- 328,332 ----
o.SetParamProp(0, 1)
if o.ParamProp(0) != 1:
! raise RuntimeError(o.paramProp(0))
# Do the connection point thing...
***************
*** 358,364 ****
ret = counter[num]
if ret != num+1:
! raise error, "Random access into element %d failed - return was %s" % (num,`ret`)
except IndexError:
! raise error, "** IndexError accessing collection element %d" % num
num = 0
--- 358,364 ----
ret = counter[num]
if ret != num+1:
! raise error("Random access into element %d failed - return was %s" % (num,`ret`))
except IndexError:
! raise error("** IndexError accessing collection element %d" % num)
num = 0
***************
*** 368,374 ****
counter.SetTestProperty(1,2)
if counter.TestPropertyWithDef != 0:
! raise error, "Unexpected property set value!"
if counter.TestPropertyNoDef(1) != 1:
! raise error, "Unexpected property set value!"
else:
pass
--- 368,374 ----
counter.SetTestProperty(1,2)
if counter.TestPropertyWithDef != 0:
! raise error("Unexpected property set value!")
if counter.TestPropertyNoDef(1) != 1:
! raise error("Unexpected property set value!")
else:
pass
***************
*** 383,387 ****
bounds = counter.GetBounds()
if bounds[0]<>1 or bounds[1]<>10:
! raise error, "** Error - counter did not give the same properties back"
counter.SetBounds(bounds[0], bounds[1])
--- 383,387 ----
bounds = counter.GetBounds()
if bounds[0]<>1 or bounds[1]<>10:
! raise error("** Error - counter did not give the same properties back")
counter.SetBounds(bounds[0], bounds[1])
***************
*** 389,395 ****
num = num + 1
if num <> len(counter):
! raise error, "*** Length of counter and loop iterations dont match ***"
if num <> 10:
! raise error, "*** Unexpected number of loop iterations ***"
counter = counter._enum_.Clone() # Test Clone() and enum directly
--- 389,395 ----
num = num + 1
if num <> len(counter):
! raise error("*** Length of counter and loop iterations dont match ***")
if num <> 10:
! raise error("*** Unexpected number of loop iterations ***")
counter = counter._enum_.Clone() # Test Clone() and enum directly
***************
*** 399,403 ****
num = num + 1
if num <> 10:
! raise error, "*** Unexpected number of loop iterations - got %d ***" % num
progress("Finished testing counter")
--- 399,403 ----
num = num + 1
if num <> 10:
! raise error("*** Unexpected number of loop iterations - got %d ***" % num)
progress("Finished testing counter")
Index: util.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/util.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** util.py 26 Nov 2008 01:27:40 -0000 1.12
--- util.py 26 Nov 2008 08:52:32 -0000 1.13
***************
*** 82,86 ****
print "Registration command was:"
print cmd
! raise RuntimeError, "Registration of engine '%s' failed" % filename
def ExecuteShellCommand(cmd, testcase,
--- 82,86 ----
print "Registration command was:"
print cmd
! raise RuntimeError("Registration of engine '%s' failed" % filename)
def ExecuteShellCommand(cmd, testcase,
***************
*** 95,105 ****
try:
if rc:
! raise Failed, "exit code was " + str(rc)
if expected_output is not None and output != expected_output:
! raise Failed, \
! "Expected output %r (got %r)" % (expected_output, output)
if not tracebacks_ok and \
output.find("Traceback (most recent call last)")>=0:
! raise Failed, "traceback in program output"
return output
except Failed, why:
--- 95,104 ----
try:
if rc:
! raise Failed("exit code was " + str(rc))
if expected_output is not None and output != expected_output:
! raise Failed("Expected output %r (got %r)" % (expected_output, output))
if not tracebacks_ok and \
output.find("Traceback (most recent call last)")>=0:
! raise Failed("traceback in program output")
return output
except Failed, why:
Index: errorSemantics.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/errorSemantics.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** errorSemantics.py 26 Nov 2008 01:21:47 -0000 1.7
--- errorSemantics.py 26 Nov 2008 08:52:32 -0000 1.8
***************
*** 129,133 ****
try:
com_server.Commit(0)
! raise RuntimeError, "should have failed"
except pythoncom.error:
pass
--- 129,133 ----
try:
com_server.Commit(0)
! raise RuntimeError("should have failed")
except pythoncom.error:
pass
***************
*** 138,142 ****
try:
com_server.Commit(0)
! raise RuntimeError, "should have failed"
except pythoncom.error:
pass
--- 138,142 ----
try:
com_server.Commit(0)
! raise RuntimeError("should have failed")
except pythoncom.error:
pass
Index: testStreams.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testStreams.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** testStreams.py 31 Aug 2007 02:08:14 -0000 1.6
--- testStreams.py 26 Nov 2008 08:52:32 -0000 1.7
***************
*** 55,59 ****
self.index = len(self.data)+dist
else:
! raise ValueError, 'Unknown Seek type: ' +str(origin)
if self.index < 0:
self.index = 0
--- 55,59 ----
self.index = len(self.data)+dist
else:
! raise ValueError('Unknown Seek type: ' +str(origin))
if self.index < 0:
self.index = 0
Index: pippo_server.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/pippo_server.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pippo_server.py 3 Jun 2007 13:27:01 -0000 1.2
--- pippo_server.py 26 Nov 2008 08:52:32 -0000 1.3
***************
*** 46,50 ****
rc = os.system ('midl "%s"' % (idl,))
if rc:
! raise RuntimeError, "Compiling MIDL failed!"
# Can't work out how to prevent MIDL from generating the stubs.
# just nuke them
--- 46,50 ----
rc = os.system ('midl "%s"' % (idl,))
if rc:
! raise RuntimeError("Compiling MIDL failed!")
# Can't work out how to prevent MIDL from generating the stubs.
# just nuke them
Index: testMSOffice.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testMSOffice.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** testMSOffice.py 26 Nov 2008 01:27:40 -0000 1.8
--- testMSOffice.py 26 Nov 2008 08:52:32 -0000 1.9
***************
*** 87,93 ****
def TextExcel(xl):
xl.Visible = 0
! if xl.Visible: raise error, "Visible property is true."
xl.Visible = 1
! if not xl.Visible: raise error, "Visible property not true."
if int(xl.Version[0])>=8:
--- 87,93 ----
def TextExcel(xl):
xl.Visible = 0
! if xl.Visible: raise error("Visible property is true.")
xl.Visible = 1
! if not xl.Visible: raise error("Visible property not true.")
if int(xl.Version[0])>=8:
***************
*** 105,123 ****
if xl.Range("A1").Value <> "Hi 0":
! raise error, "Single cell range failed"
if xl.Range("A1:B1").Value <> ((Unicode("Hi 0"),2),):
! raise error, "flat-horizontal cell range failed"
if xl.Range("A1:A2").Value <> ((Unicode("Hi 0"),),(Unicode("x"),)):
! raise error, "flat-vertical cell range failed"
if xl.Range("A1:C3").Value <> ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
! raise error, "square cell range failed"
xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))
if xl.Range("A1:C3").Value <> ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
! raise error, "Range was not what I set it to!"
# test dates out with Excel
--- 105,123 ----
if xl.Range("A1").Value <> "Hi 0":
! raise error("Single cell range failed")
if xl.Range("A1:B1").Value <> ((Unicode("Hi 0"),2),):
! raise error("flat-horizontal cell range failed")
if xl.Range("A1:A2").Value <> ((Unicode("Hi 0"),),(Unicode("x"),)):
! raise error("flat-vertical cell range failed")
if xl.Range("A1:C3").Value <> ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
! raise error("square cell range failed")
xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))
if xl.Range("A1:C3").Value <> ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
! raise error("Range was not what I set it to!")
# test dates out with Excel
Index: testGIT.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testGIT.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** testGIT.py 10 Jan 2006 04:04:00 -0000 1.1
--- testGIT.py 26 Nov 2008 08:52:32 -0000 1.2
***************
*** 29,40 ****
def TestInterp(interp):
if interp.Eval("1+1") <> 2:
! raise ValueError, "The interpreter returned the wrong result."
try:
interp.Eval(1+1)
! raise ValueError, "The interpreter did not raise an exception"
except pythoncom.com_error, details:
import winerror
if details[0]!=winerror.DISP_E_TYPEMISMATCH:
! raise ValueError, "The interpreter exception was not winerror.DISP_E_TYPEMISMATCH."
--- 29,40 ----
def TestInterp(interp):
if interp.Eval("1+1") <> 2:
! raise ValueError("The interpreter returned the wrong result.")
try:
interp.Eval(1+1)
! raise ValueError("The interpreter did not raise an exception")
except pythoncom.com_error, details:
import winerror
if details[0]!=winerror.DISP_E_TYPEMISMATCH:
! raise ValueError("The interpreter exception was not winerror.DISP_E_TYPEMISMATCH.")
Index: testNetscape.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testNetscape.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** testNetscape.py 18 Nov 2002 11:20:07 -0000 1.2
--- testNetscape.py 26 Nov 2008 08:52:32 -0000 1.3
***************
*** 11,15 ****
n=netscape.CNetworkCX()
rc = n.Open("http://d|/temp/apyext.html", 0, None, 0, None)
! if not rc: raise error, "Open method of Netscape failed"
while 1:
num, str = n.Read(None, 0)
--- 11,15 ----
n=netscape.CNetworkCX()
rc = n.Open("http://d|/temp/apyext.html", 0, None, 0, None)
! if not rc: raise error("Open method of Netscape failed")
while 1:
num, str = n.Read(None, 0)
Index: testDynamic.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testDynamic.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** testDynamic.py 18 Nov 2002 11:20:06 -0000 1.3
--- testDynamic.py 26 Nov 2008 08:52:32 -0000 1.4
***************
*** 53,62 ****
client.ANewAttr = "Hello"
if client.ANewAttr != "Hello":
! raise error, "Could not set dynamic property"
v = ["Hello","From","Python",1.4]
client.TestSequence = v
if v != list(client.TestSequence):
! raise error, "Dynamic sequences not working! %r/%r" % (repr(v), repr(client.testSequence))
client.write("This","output","has","come","via","COM")
--- 53,62 ----
client.ANewAttr = "Hello"
if client.ANewAttr != "Hello":
! raise error("Could not set dynamic property")
v = ["Hello","From","Python",1.4]
client.TestSequence = v
if v != list(client.TestSequence):
! raise error("Dynamic sequences not working! %r/%r" % (repr(v), repr(client.testSequence)))
client.write("This","output","has","come","via","COM")
***************
*** 64,68 ****
client._FlagAsMethod("NotReallyAMethod")
if not callable(client.NotReallyAMethod):
! raise error, "Method I flagged as callable isn't!"
--- 64,68 ----
client._FlagAsMethod("NotReallyAMethod")
if not callable(client.NotReallyAMethod):
! raise error("Method I flagged as callable isn't!")
Index: testCollections.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testCollections.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** testCollections.py 10 Nov 2003 00:49:29 -0000 1.4
--- testCollections.py 26 Nov 2008 08:52:32 -0000 1.5
***************
*** 34,42 ****
for i in range(len(check)):
if o(i) != check[i]:
! raise error, "Using default method gave the incorrect value - %s/%s" % (`o(i)`, `check[i]`)
for i in range(len(check)):
if o.Item(i) != check[i]:
! raise error, "Using Item method gave the incorrect value - %s/%s" % (`o(i)`, `check[i]`)
# First try looping.
--- 34,42 ----
for i in range(len(check)):
if o(i) != check[i]:
! raise error("Using default method gave the incorrect value - %s/%s" % (`o(i)`, `check[i]`))
for i in range(len(check)):
if o.Item(i) != check[i]:
! raise error("Using Item method gave the incorrect value - %s/%s" % (`o(i)`, `check[i]`))
# First try looping.
***************
*** 46,54 ****
if cmp[:len(check)] != check:
! raise error, "Result after looping isnt correct - %s/%s" % (`cmp[:len(check)]`, `check`)
for i in range(len(check)):
if o[i] != check[i]:
! raise error, "Using indexing gave the incorrect value"
--- 46,54 ----
if cmp[:len(check)] != check:
! raise error("Result after looping isnt correct - %s/%s" % (`cmp[:len(check)]`, `check`))
for i in range(len(check)):
if o[i] != check[i]:
! raise error("Using indexing gave the incorrect value")
***************
*** 91,113 ****
try:
o()
! raise error, "default method with no args worked when it shouldnt have!"
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADPARAMCOUNT:
! raise error, "Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc)
try:
o.Insert("foo", 2)
! raise error, "Insert worked when it shouldnt have!"
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_TYPEMISMATCH:
! raise error, "Expected DISP_E_TYPEMISMATCH - got %d (%s)" % (hr, desc)
# Remove the sublist for this test!
try:
o.Remove(o.Count())
! raise error, "Remove worked when it shouldnt have!"
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADINDEX:
! raise error, "Expected DISP_E_BADINDEX - got %d (%s)" % (hr, desc)
# Test an empty collection
--- 91,113 ----
try:
o()
! raise error("default method with no args worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADPARAMCOUNT:
! raise error("Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc))
try:
o.Insert("foo", 2)
! raise error("Insert worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_TYPEMISMATCH:
! raise error("Expected DISP_E_TYPEMISMATCH - got %d (%s)" % (hr, desc))
# Remove the sublist for this test!
try:
o.Remove(o.Count())
! raise error("Remove worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADINDEX:
! raise error("Expected DISP_E_BADINDEX - got %d (%s)" % (hr, desc))
# Test an empty collection
***************
*** 115,123 ****
o = MakeEmptyEnum()
for item in o:
! raise error, "Empty list performed an iteration"
try:
ob = o[1]
! raise error, "Empty list could be indexed"
except IndexError:
pass
--- 115,123 ----
o = MakeEmptyEnum()
for item in o:
! raise error("Empty list performed an iteration")
try:
ob = o[1]
! raise error("Empty list could be indexed")
except IndexError:
pass
***************
*** 125,129 ****
try:
ob = o[0]
! raise error, "Empty list could be indexed"
except IndexError:
pass
--- 125,129 ----
try:
ob = o[0]
! raise error("Empty list could be indexed")
except IndexError:
pass
***************
*** 131,138 ****
try:
ob = o(0)
! raise error, "Empty list could be indexed"
except pythoncom.com_error, (hr, fn, desc, arg):
if hr != winerror.DISP_E_BADINDEX:
! raise error, "Expected DISP_E_BADINDEX - got %d (%s)" % (hr, desc)
class TestCase(win32com.test.util.TestCase):
--- 131,138 ----
try:
ob = o(0)
! raise error("Empty list could be indexed")
except pythoncom.com_error, (hr, fn, desc, arg):
if hr != winerror.DISP_E_BADINDEX:
! raise error("Expected DISP_E_BADINDEX - got %d (%s)" % (hr, desc))
class TestCase(win32com.test.util.TestCase):
Index: testall.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** testall.py 26 Nov 2008 08:39:33 -0000 1.30
--- testall.py 26 Nov 2008 08:52:32 -0000 1.31
***************
*** 196,200 ****
testLevel = int(arg)
if testLevel < 0 or testLevel > 3:
! raise ValueError, "Only levels 1-3 are supported"
except ValueError:
test_names.append(arg)
--- 196,200 ----
testLevel = int(arg)
if testLevel < 0 or testLevel > 3:
! raise ValueError("Only levels 1-3 are supported")
except ValueError:
test_names.append(arg)
Index: testExplorer.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testExplorer.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** testExplorer.py 26 Nov 2008 01:27:40 -0000 1.8
--- testExplorer.py 26 Nov 2008 08:52:32 -0000 1.9
***************
*** 27,31 ****
iexplore.Visible = 1
if not bVisibleEventFired:
! raise RuntimeError, "The IE event did not appear to fire!"
iexplore.Quit()
iexplore = None
--- 27,31 ----
iexplore.Visible = 1
if not bVisibleEventFired:
! raise RuntimeError("The IE event did not appear to fire!")
iexplore.Quit()
iexplore = None
***************
*** 36,40 ****
ie.Visible = 1
if not bVisibleEventFired:
! raise RuntimeError, "The IE event did not appear to fire!"
ie.Quit()
ie = None
--- 36,40 ----
ie.Visible = 1
if not bVisibleEventFired:
! raise RuntimeError("The IE event did not appear to fire!")
ie.Quit()
ie = None
Index: testDictionary.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testDictionary.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** testDictionary.py 26 Nov 2008 01:27:40 -0000 1.7
--- testDictionary.py 26 Nov 2008 08:52:32 -0000 1.8
***************
*** 20,24 ****
for key, value in check.items():
if dict(key) != value:
! raise error, "Indexing for '%s' gave the incorrect value - %s/%s" % (`key`, `dict[key]`, `check[key]`)
# Ensure we have the correct version registered.
--- 20,24 ----
for key, value in check.items():
if dict(key) != value:
! raise error("Indexing for '%s' gave the incorrect value - %s/%s" % (`key`, `dict[key]`, `check[key]`))
# Ensure we have the correct version registered.
***************
*** 50,71 ****
try:
dict()
! raise error, "default method with no args worked when it shouldnt have!"
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADPARAMCOUNT:
! raise error, "Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc)
try:
dict("hi", "there")
! raise error, "multiple args worked when it shouldnt have!"
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADPARAMCOUNT:
! raise error, "Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc)
try:
dict(0)
! raise error, "int key worked when it shouldnt have!"
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_TYPEMISMATCH:
! raise error, "Expected DISP_E_TYPEMISMATCH - got %d (%s)" % (hr, desc)
if not quiet:
--- 50,71 ----
try:
dict()
! raise error("default method with no args worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADPARAMCOUNT:
! raise error("Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc))
try:
dict("hi", "there")
! raise error("multiple args worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_BADPARAMCOUNT:
! raise error("Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc))
try:
dict(0)
! raise error("int key worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_TYPEMISMATCH:
! raise error("Expected DISP_E_TYPEMISMATCH - got %d (%s)" % (hr, desc))
if not quiet:
|