Skip to content

Commit 1160d18

Browse files
committed
Reorder new tests
1 parent c433f19 commit 1160d18

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

clang/bindings/python/tests/cindex/test_cursor.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,20 @@ def test_pretty_print(self):
997997
self.assertEqual(pp.get_property(PrintingPolicyProperty.Bool), False)
998998
self.assertEqual(f.pretty_printed(pp), "void f(_Bool x) {\n}\n")
999999

1000+
def test_hash(self):
1001+
def accumulate_cursors(cursor: Cursor, all_cursors: list[Cursor]):
1002+
all_cursors.append(cursor)
1003+
for child in cursor.get_children():
1004+
all_cursors = accumulate_cursors(child, all_cursors)
1005+
return all_cursors
1006+
1007+
tu = get_tu(kInput)
1008+
all_cursors = accumulate_cursors(tu.cursor, [])
1009+
cursor_hashes = set()
1010+
for cursor in all_cursors:
1011+
self.assertNotIn(hash(cursor), cursor_hashes)
1012+
cursor_hashes.add(hash(cursor))
1013+
10001014
def test_has_attrs(self):
10011015
tu = get_tu(
10021016
"""
@@ -1013,20 +1027,6 @@ def test_has_attrs(self):
10131027
self.assertTrue(A.get_definition().has_attrs())
10141028
self.assertFalse(B.get_definition().has_attrs())
10151029

1016-
def test_hash(self):
1017-
def accumulate_cursors(cursor: Cursor, all_cursors: list[Cursor]):
1018-
all_cursors.append(cursor)
1019-
for child in cursor.get_children():
1020-
all_cursors = accumulate_cursors(child, all_cursors)
1021-
return all_cursors
1022-
1023-
tu = get_tu(kInput)
1024-
all_cursors = accumulate_cursors(tu.cursor, [])
1025-
cursor_hashes = set()
1026-
for cursor in all_cursors:
1027-
self.assertNotIn(hash(cursor), cursor_hashes)
1028-
cursor_hashes.add(hash(cursor))
1029-
10301030
def test_specialized_template(self):
10311031
tu = get_tu(kTemplateArgTest, lang="cpp")
10321032
foos = get_cursors(tu, "foo")

0 commit comments

Comments
 (0)