[pywin32-checkins] pywin32/com/win32com/test testPyComTest.py,1.13,1.14
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: <mha...@us...> - 2003-07-03 03:44:42
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory sc8-pr-cvs1:/tmp/cvs-serv28341
Modified Files:
testPyComTest.py
Log Message:
Make "quiet" really mean "quiet"
Index: testPyComTest.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** testPyComTest.py 18 Dec 2002 03:57:28 -0000 1.13
--- testPyComTest.py 3 Jul 2003 03:44:39 -0000 1.14
***************
*** 24,27 ****
--- 24,33 ----
verbose = 0
+ def progress(*args):
+ if verbose:
+ for arg in args:
+ print arg,
+ print
+
def TestApplyResult(fn, args, result):
try:
***************
*** 30,35 ****
except:
fnName = str(fn)
! if verbose:
! print "Testing ", fnName,
pref = "function " + fnName
try:
--- 36,40 ----
except:
fnName = str(fn)
! progress("Testing ", fnName)
pref = "function " + fnName
try:
***************
*** 42,48 ****
raise error, "%s caused exception %s,%s" % (pref, t, v)
- if verbose: print
-
-
# Simple handler class. This demo only fires one event.
class RandomEventHandler:
--- 47,50 ----
***************
*** 58,74 ****
print "ERROR: Nothing was recieved!"
for firedId, no in self.fireds.items():
! if verbose:
! print "ID %d fired %d times" % (firedId, no)
def TestDynamic():
! if verbose: print "Testing Dynamic"
import win32com.client.dynamic
o = win32com.client.dynamic.DumbDispatch("PyCOMTest.PyCOMTest")
! if verbose: print "Getting counter"
counter = o.GetSimpleCounter()
TestCounter(counter, 0)
! if verbose: print "Checking default args"
rc = o.TestOptionals()
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
--- 60,75 ----
print "ERROR: Nothing was recieved!"
for firedId, no in self.fireds.items():
! progress("ID %d fired %d times" % (firedId, no))
def TestDynamic():
! progress("Testing Dynamic")
import win32com.client.dynamic
o = win32com.client.dynamic.DumbDispatch("PyCOMTest.PyCOMTest")
! progress("Getting counter")
counter = o.GetSimpleCounter()
TestCounter(counter, 0)
! progress("Checking default args")
rc = o.TestOptionals()
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
***************
*** 90,94 ****
# if verbose: print "Testing structs"
r = o.GetStruct()
- print str(r.str_value)
assert r.int_value == 99 and str(r.str_value)=="Hello from C++"
counter = win32com.client.dynamic.DumbDispatch("PyCOMTest.SimpleCounter")
--- 91,94 ----
***************
*** 123,127 ****
del i2
! if verbose: print "Checking default args"
rc = o.TestOptionals()
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
--- 123,127 ----
del i2
! progress("Checking default args")
rc = o.TestOptionals()
if rc[:-1] != ("def", 0, 1) or abs(rc[-1]-3.14)>.01:
***************
*** 141,155 ****
raise error, "Did not get the specified optional2 values correctly"
! if verbose: print "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())
! if verbose: print "Checking getting/passing IUnknown"
if o.GetSetUnknown(o) != o:
raise error, "GetSetUnknown failed"
! if verbose: print "Checking getting/passing IDispatch"
if type(o.GetSetDispatch(o)) !=types.InstanceType:
raise error, "GetSetDispatch failed"
! if verbose: print "Checking getting/passing IDispatch of known type"
if o.GetSetInterface(o).__class__ != o.__class__:
raise error, "GetSetDispatch failed"
--- 141,155 ----
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"
***************
*** 190,194 ****
# Do the connection point thing...
# Create a connection object.
! if verbose: print "Testing connection points"
sessions = []
o = win32com.client.DispatchWithEvents( o, RandomEventHandler)
--- 190,194 ----
# Do the connection point thing...
# Create a connection object.
! progress("Testing connection points")
sessions = []
o = win32com.client.DispatchWithEvents( o, RandomEventHandler)
***************
*** 205,213 ****
o.Stop(session)
o._DumpFireds()
! if verbose: print "Finished generated .py test."
def TestCounter(counter, bIsGenerated):
# Test random access into container
! if verbose: print "Testing counter", `counter`
import random
for i in xrange(50):
--- 205,213 ----
o.Stop(session)
o._DumpFireds()
! progress("Finished generated .py test.")
def TestCounter(counter, bIsGenerated):
# Test random access into container
! progress("Testing counter", `counter`)
import random
for i in xrange(50):
***************
*** 258,262 ****
if num <> 10:
raise error, "*** Unexpected number of loop iterations - got %d ***" % num
! if verbose: print "Finished testing counter"
def TestLocalVTable(ob):
--- 258,262 ----
if num <> 10:
raise error, "*** Unexpected number of loop iterations - got %d ***" % num
! progress("Finished testing counter")
def TestLocalVTable(ob):
***************
*** 305,309 ****
for i in range(iterations):
! print prompt[long_lived_server!=0] % (i+1, iterations)
tester.TestQueryInterface()
--- 305,309 ----
for i in range(iterations):
! progress(prompt[long_lived_server!=0] % (i+1, iterations))
tester.TestQueryInterface()
***************
*** 314,322 ****
# to 1 to pass this test, i.e. for i in range(1)
for i in range(2):
! print "Testing VTables in-process #%d..." % (i+1)
TestVTable(pythoncom.CLSCTX_INPROC_SERVER)
for i in range(2):
! print "Testing VTables out-of-process #%d..." % (i+1)
TestVTable(pythoncom.CLSCTX_LOCAL_SERVER)
--- 314,322 ----
# to 1 to pass this test, i.e. for i in range(1)
for i in range(2):
! progress("Testing VTables in-process #%d..." % (i+1))
TestVTable(pythoncom.CLSCTX_INPROC_SERVER)
for i in range(2):
! progress("Testing VTables out-of-process #%d..." % (i+1))
TestVTable(pythoncom.CLSCTX_LOCAL_SERVER)
***************
*** 342,350 ****
return
! print "Testing Universal Gateway..."
TestMultiVTable()
TestMultiQueryInterface()
! print "Testing Python COM Test Horse..."
TestDynamic()
TestGenerated()
--- 342,350 ----
return
! progress("Testing Universal Gateway...")
TestMultiVTable()
TestMultiQueryInterface()
! progress("Testing Python COM Test Horse...")
TestDynamic()
TestGenerated()
|