policySemantics.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:pupy 作者: ru-faraon 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号