def DispExTest(ob):
if not __debug__: print "WARNING: Tests dressed up as assertions are being skipped!"
assert ob.GetDispID("Add", 0)==10, "Policy did not honour the dispid"
# Not impl
# assert ob.GetMemberName(10, 0)=="add", "Policy did not give me the correct function for the dispid"
assert ob.GetDispID("Remove", 0)==11, "Policy did not honour the dispid"
assert ob.GetDispID("In", 0)==1000, "Allocated dispid unexpected value"
assert ob.GetDispID("_NewEnum", 0)==pythoncom.DISPID_NEWENUM, "_NewEnum() got unexpected DISPID"
dispids = []
dispid = -1
while 1:
try:
dispid = ob.GetNextDispID(0, dispid)
dispids.append(dispid)
except pythoncom.com_error, (hr, desc, exc, arg):
assert hr==winerror.S_FALSE, "Bad result at end of enum"
break
dispids.sort()
if dispids != [pythoncom.DISPID_EVALUATE, pythoncom.DISPID_NEWENUM, 10, 11, 1000]:
raise Error("Got back the wrong dispids: %s" % dispids)
评论列表
文章目录