

def test_LoadTypeLibEx(self):
    if os.path.exists(os.path.join(os.environ['SystemRoot'], 'system32', 'ieframe.dll')):
        dllname = 'ieframe.dll'
    else:
        dllname = 'shdocvw.dll'
    self.assertRaises(WindowsError, (lambda : LoadTypeLibEx('<xxx.xx>')))
    tlib = LoadTypeLibEx(dllname)
    self.failUnless(tlib.GetTypeInfoCount())
    tlib.GetDocumentation((- 1))
    self.failUnlessEqual(tlib.IsName('iwebbrowser'), 'IWebBrowser')
    self.failUnlessEqual(tlib.IsName('IWEBBROWSER'), 'IWebBrowser')
    self.failUnless(tlib.FindName('IWebBrowser'))
    self.failUnlessEqual(tlib.IsName('Spam'), None)
    tlib.GetTypeComp()
    attr = tlib.GetLibAttr()
    info = (attr.guid, attr.wMajorVerNum, attr.wMinorVerNum)
    other_tlib = LoadRegTypeLib(*info)
    self.failUnlessEqual(tlib, other_tlib)
    for i in range(tlib.GetTypeInfoCount()):
        ti = tlib.GetTypeInfo(i)
        ti.GetTypeAttr()
        tlib.GetDocumentation(i)
        tlib.GetTypeInfoType(i)
        (c_tlib, index) = ti.GetContainingTypeLib()
        self.failUnlessEqual(c_tlib, tlib)
        self.failUnlessEqual(index, i)
    guid_null = GUID()
    self.assertRaises(COMError, (lambda : tlib.GetTypeInfoOfGuid(guid_null)))
    self.failUnless(tlib.GetTypeInfoOfGuid(GUID('{EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B}')))
    path = QueryPathOfRegTypeLib(*info)
    path = path.split('\x00')[0]
    self.failUnless(path.lower().endswith(dllname))

dataset/ETHPy150Open enthought/comtypes/comtypes/test/test_typeinfo.py Test.test_LoadTypeLibEx/original