test_translation_unit.py revision 1b945a7455e17fd792ef3bd3790dc88beea5faad
1from clang.cindex import *
2import os
3
4kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
5
6def test_spelling():
7    path = os.path.join(kInputsDir, 'hello.cpp')
8    index = Index.create()
9    tu = index.parse(path)
10    assert str(tu.spelling) == path
11
12def test_cursor():
13    path = os.path.join(kInputsDir, 'hello.cpp')
14    index = Index.create()
15    tu = index.parse(path)
16    c = tu.cursor
17    assert isinstance(c, Cursor)
18    assert c.is_translation_unit
19