summaryrefslogtreecommitdiff
path: root/bindings/python/tests/cindex
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:08 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:08 +0000
commitbab175ec4b075c8076ba14c762900392533f6ee4 (patch)
tree01f4f29419a2cb10abe13c1e63cd2a66068b0137 /bindings/python/tests/cindex
parent8b7a8012d223fac5d17d16a66bb39168a9a1dfc0 (diff)
Notes
Diffstat (limited to 'bindings/python/tests/cindex')
-rw-r--r--bindings/python/tests/cindex/test_cursor.py2
-rw-r--r--bindings/python/tests/cindex/test_cursor_kind.py3
-rw-r--r--bindings/python/tests/cindex/test_tokens.py2
-rw-r--r--bindings/python/tests/cindex/test_translation_unit.py8
4 files changed, 10 insertions, 5 deletions
diff --git a/bindings/python/tests/cindex/test_cursor.py b/bindings/python/tests/cindex/test_cursor.py
index 6c8230d4283c4..8103e96df4f9e 100644
--- a/bindings/python/tests/cindex/test_cursor.py
+++ b/bindings/python/tests/cindex/test_cursor.py
@@ -375,7 +375,7 @@ def test_get_tokens():
foo = get_cursor(tu, 'foo')
tokens = list(foo.get_tokens())
- assert len(tokens) == 7
+ assert len(tokens) == 6
assert tokens[0].spelling == 'int'
assert tokens[1].spelling == 'foo'
diff --git a/bindings/python/tests/cindex/test_cursor_kind.py b/bindings/python/tests/cindex/test_cursor_kind.py
index 5bac289625be2..4d8d88b92131e 100644
--- a/bindings/python/tests/cindex/test_cursor_kind.py
+++ b/bindings/python/tests/cindex/test_cursor_kind.py
@@ -42,7 +42,8 @@ def test_kind_groups():
CursorKind.MACRO_DEFINITION,
CursorKind.MACRO_INSTANTIATION,
CursorKind.INCLUSION_DIRECTIVE,
- CursorKind.PREPROCESSING_DIRECTIVE):
+ CursorKind.PREPROCESSING_DIRECTIVE,
+ CursorKind.OVERLOAD_CANDIDATE):
assert len(group) == 0
else:
assert len(group) == 1
diff --git a/bindings/python/tests/cindex/test_tokens.py b/bindings/python/tests/cindex/test_tokens.py
index 70748429094ae..688b5c1c900e2 100644
--- a/bindings/python/tests/cindex/test_tokens.py
+++ b/bindings/python/tests/cindex/test_tokens.py
@@ -14,7 +14,7 @@ def test_token_to_cursor():
r = tu.get_extent('t.c', (0, 9))
tokens = list(tu.get_tokens(extent=r))
- assert len(tokens) == 5
+ assert len(tokens) == 4
assert tokens[1].spelling == 'i'
assert tokens[1].kind == TokenKind.IDENTIFIER
diff --git a/bindings/python/tests/cindex/test_translation_unit.py b/bindings/python/tests/cindex/test_translation_unit.py
index be6cd671ae0c0..f959cf4aafcc5 100644
--- a/bindings/python/tests/cindex/test_translation_unit.py
+++ b/bindings/python/tests/cindex/test_translation_unit.py
@@ -59,9 +59,13 @@ int SOME_DEFINE;
assert spellings[-1] == 'y'
def test_unsaved_files_2():
- import StringIO
+ try:
+ from StringIO import StringIO
+ except:
+ from io import StringIO
+
tu = TranslationUnit.from_source('fake.c', unsaved_files = [
- ('fake.c', StringIO.StringIO('int x;'))])
+ ('fake.c', StringIO('int x;'))])
spellings = [c.spelling for c in tu.cursor.get_children()]
assert spellings[-1] == 'x'