importosfromclang.cindeximportConfigif'CLANG_LIBRARY_PATH'inos.environ:Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])fromclang.cindeximport*importosimportunittestkInputsDir=os.path.join(os.path.dirname(__file__),'INPUTS')classTestIndex(unittest.TestCase):deftest_create(self):index=Index.create()# FIXME: test Index.read
deftest_parse(self):index=Index.create()self.assertIsInstance(index,Index)tu=index.parse(os.path.join(kInputsDir,'hello.cpp'))self.assertIsInstance(tu,TranslationUnit)tu=index.parse(None,['-c',os.path.join(kInputsDir,'hello.cpp')])self.assertIsInstance(tu,TranslationUnit)