Skip to content

Commit a91d221

Browse files
committed
Remove k_ prefix
1 parent 926d2f7 commit a91d221

File tree

5 files changed

+44
-44
lines changed

5 files changed

+44
-44
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import sys
1111
from pathlib import Path
1212

13-
k_inputs_dir = os.path.join(os.path.dirname(__file__), "INPUTS")
13+
inputs_dir = os.path.join(os.path.dirname(__file__), "INPUTS")
1414

1515

1616
@unittest.skipIf(sys.platform == "win32", "TODO: Fix these tests on Windows")
@@ -34,23 +34,23 @@ def test_create_fail(self):
3434

3535
def test_create(self):
3636
"""Check we can load a compilation database"""
37-
CompilationDatabase.fromDirectory(k_inputs_dir)
37+
CompilationDatabase.fromDirectory(inputs_dir)
3838

3939
def test_lookup_succeed(self):
4040
"""Check we get some results if the file exists in the db"""
41-
cdb = CompilationDatabase.fromDirectory(k_inputs_dir)
41+
cdb = CompilationDatabase.fromDirectory(inputs_dir)
4242
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project.cpp")
4343
self.assertNotEqual(len(cmds), 0)
4444

4545
def test_lookup_succeed_pathlike(self):
4646
"""Same as test_lookup_succeed, but with PathLikes"""
47-
cdb = CompilationDatabase.fromDirectory(Path(k_inputs_dir))
47+
cdb = CompilationDatabase.fromDirectory(Path(inputs_dir))
4848
cmds = cdb.getCompileCommands(Path("/home/john.doe/MyProject/project.cpp"))
4949
self.assertNotEqual(len(cmds), 0)
5050

5151
def test_all_compilecommand(self):
5252
"""Check we get all results from the db"""
53-
cdb = CompilationDatabase.fromDirectory(k_inputs_dir)
53+
cdb = CompilationDatabase.fromDirectory(inputs_dir)
5454
cmds = cdb.getAllCompileCommands()
5555
self.assertEqual(len(cmds), 3)
5656
expected = [
@@ -100,7 +100,7 @@ def test_all_compilecommand(self):
100100

101101
def test_1_compilecommand(self):
102102
"""Check file with single compile command"""
103-
cdb = CompilationDatabase.fromDirectory(k_inputs_dir)
103+
cdb = CompilationDatabase.fromDirectory(inputs_dir)
104104
file = "/home/john.doe/MyProject/project.cpp"
105105
cmds = cdb.getCompileCommands(file)
106106
self.assertEqual(len(cmds), 1)
@@ -119,7 +119,7 @@ def test_1_compilecommand(self):
119119

120120
def test_2_compilecommand(self):
121121
"""Check file with 2 compile commands"""
122-
cdb = CompilationDatabase.fromDirectory(k_inputs_dir)
122+
cdb = CompilationDatabase.fromDirectory(inputs_dir)
123123
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project2.cpp")
124124
self.assertEqual(len(cmds), 2)
125125
expected = [
@@ -154,23 +154,23 @@ def test_2_compilecommand(self):
154154

155155
def test_compilecommand_iterator_stops(self):
156156
"""Check that iterator stops after the correct number of elements"""
157-
cdb = CompilationDatabase.fromDirectory(k_inputs_dir)
157+
cdb = CompilationDatabase.fromDirectory(inputs_dir)
158158
count = 0
159159
for cmd in cdb.getCompileCommands("/home/john.doe/MyProject/project2.cpp"):
160160
count += 1
161161
self.assertLessEqual(count, 2)
162162

163163
def test_compilationDB_references(self):
164164
"""Ensure CompilationsCommands are independent of the database"""
165-
cdb = CompilationDatabase.fromDirectory(k_inputs_dir)
165+
cdb = CompilationDatabase.fromDirectory(inputs_dir)
166166
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project.cpp")
167167
del cdb
168168
gc.collect()
169169
cmds[0].directory
170170

171171
def test_compilationCommands_references(self):
172172
"""Ensure CompilationsCommand keeps a reference to CompilationCommands"""
173-
cdb = CompilationDatabase.fromDirectory(k_inputs_dir)
173+
cdb = CompilationDatabase.fromDirectory(inputs_dir)
174174
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project.cpp")
175175
del cdb
176176
cmd0 = cmds[0]

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from .util import get_cursor, get_cursors, get_tu
2323

24-
k_input = """\
24+
children_test = """\
2525
struct s0 {
2626
int a;
2727
int b;
@@ -41,23 +41,23 @@
4141
}
4242
"""
4343

44-
k_parent_test = """\
44+
parent_test = """\
4545
class C {
4646
void f();
4747
}
4848
4949
void C::f() { }
5050
"""
5151

52-
k_template_arg_test = """\
52+
template_arg_test = """\
5353
template <int kInt, typename T, bool kBool>
5454
void foo();
5555
5656
template<>
5757
void foo<-7, float, true>();
5858
"""
5959

60-
k_binops = """\
60+
binops = """\
6161
struct C {
6262
int m;
6363
};
@@ -118,7 +118,7 @@ class C {
118118

119119
class TestCursor(unittest.TestCase):
120120
def test_get_children(self):
121-
tu = get_tu(k_input)
121+
tu = get_tu(children_test)
122122

123123
it = tu.cursor.get_children()
124124
tu_nodes = list(it)
@@ -613,15 +613,15 @@ def test_underlying_type(self):
613613
self.assertEqual(underlying.kind, TypeKind.INT)
614614

615615
def test_semantic_parent(self):
616-
tu = get_tu(k_parent_test, "cpp")
616+
tu = get_tu(parent_test, "cpp")
617617
curs = get_cursors(tu, "f")
618618
decl = get_cursor(tu, "C")
619619
self.assertEqual(len(curs), 2)
620620
self.assertEqual(curs[0].semantic_parent, curs[1].semantic_parent)
621621
self.assertEqual(curs[0].semantic_parent, decl)
622622

623623
def test_lexical_parent(self):
624-
tu = get_tu(k_parent_test, "cpp")
624+
tu = get_tu(parent_test, "cpp")
625625
curs = get_cursors(tu, "f")
626626
decl = get_cursor(tu, "C")
627627
self.assertEqual(len(curs), 2)
@@ -865,13 +865,13 @@ def test_get_arguments(self):
865865
self.assertEqual(arguments[1].spelling, "j")
866866

867867
def test_get_num_template_arguments(self):
868-
tu = get_tu(k_template_arg_test, lang="cpp")
868+
tu = get_tu(template_arg_test, lang="cpp")
869869
foos = get_cursors(tu, "foo")
870870

871871
self.assertEqual(foos[1].get_num_template_arguments(), 3)
872872

873873
def test_get_template_argument_kind(self):
874-
tu = get_tu(k_template_arg_test, lang="cpp")
874+
tu = get_tu(template_arg_test, lang="cpp")
875875
foos = get_cursors(tu, "foo")
876876

877877
self.assertEqual(
@@ -885,20 +885,20 @@ def test_get_template_argument_kind(self):
885885
)
886886

887887
def test_get_template_argument_type(self):
888-
tu = get_tu(k_template_arg_test, lang="cpp")
888+
tu = get_tu(template_arg_test, lang="cpp")
889889
foos = get_cursors(tu, "foo")
890890

891891
self.assertEqual(foos[1].get_template_argument_type(1).kind, TypeKind.FLOAT)
892892

893893
def test_get_template_argument_value(self):
894-
tu = get_tu(k_template_arg_test, lang="cpp")
894+
tu = get_tu(template_arg_test, lang="cpp")
895895
foos = get_cursors(tu, "foo")
896896

897897
self.assertEqual(foos[1].get_template_argument_value(0), -7)
898898
self.assertEqual(foos[1].get_template_argument_value(2), True)
899899

900900
def test_get_template_argument_unsigned_value(self):
901-
tu = get_tu(k_template_arg_test, lang="cpp")
901+
tu = get_tu(template_arg_test, lang="cpp")
902902
foos = get_cursors(tu, "foo")
903903

904904
self.assertEqual(foos[1].get_template_argument_unsigned_value(0), 2**32 - 7)
@@ -930,7 +930,7 @@ def test_mangled_name(self):
930930
)
931931

932932
def test_binop(self):
933-
tu = get_tu(k_binops, lang="cpp")
933+
tu = get_tu(binops, lang="cpp")
934934

935935
operators = {
936936
# not exposed yet

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import unittest
99

10-
k_inputs_dir = os.path.join(os.path.dirname(__file__), "INPUTS")
10+
inputs_dir = os.path.join(os.path.dirname(__file__), "INPUTS")
1111

1212

1313
class TestIndex(unittest.TestCase):
@@ -19,7 +19,7 @@ def test_create(self):
1919
def test_parse(self):
2020
index = Index.create()
2121
self.assertIsInstance(index, Index)
22-
tu = index.parse(os.path.join(k_inputs_dir, "hello.cpp"))
22+
tu = index.parse(os.path.join(inputs_dir, "hello.cpp"))
2323
self.assertIsInstance(tu, TranslationUnit)
24-
tu = index.parse(None, ["-c", os.path.join(k_inputs_dir, "hello.cpp")])
24+
tu = index.parse(None, ["-c", os.path.join(inputs_dir, "hello.cpp")])
2525
self.assertIsInstance(tu, TranslationUnit)

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from .util import get_cursor, get_tu
2626

27-
k_inputs_dir = os.path.join(os.path.dirname(__file__), "INPUTS")
27+
inputs_dir = os.path.join(os.path.dirname(__file__), "INPUTS")
2828

2929

3030
@contextmanager
@@ -51,26 +51,26 @@ def save_tu_pathlike(tu):
5151

5252
class TestTranslationUnit(unittest.TestCase):
5353
def test_spelling(self):
54-
path = os.path.join(k_inputs_dir, "hello.cpp")
54+
path = os.path.join(inputs_dir, "hello.cpp")
5555
tu = TranslationUnit.from_source(path)
5656
self.assertEqual(tu.spelling, path)
5757

5858
def test_cursor(self):
59-
path = os.path.join(k_inputs_dir, "hello.cpp")
59+
path = os.path.join(inputs_dir, "hello.cpp")
6060
tu = get_tu(path)
6161
c = tu.cursor
6262
self.assertIsInstance(c, Cursor)
6363
self.assertIs(c.kind, CursorKind.TRANSLATION_UNIT)
6464

6565
def test_parse_arguments(self):
66-
path = os.path.join(k_inputs_dir, "parse_arguments.c")
66+
path = os.path.join(inputs_dir, "parse_arguments.c")
6767
tu = TranslationUnit.from_source(path, ["-DDECL_ONE=hello", "-DDECL_TWO=hi"])
6868
spellings = [c.spelling for c in tu.cursor.get_children()]
6969
self.assertEqual(spellings[-2], "hello")
7070
self.assertEqual(spellings[-1], "hi")
7171

7272
def test_reparse_arguments(self):
73-
path = os.path.join(k_inputs_dir, "parse_arguments.c")
73+
path = os.path.join(inputs_dir, "parse_arguments.c")
7474
tu = TranslationUnit.from_source(path, ["-DDECL_ONE=hello", "-DDECL_TWO=hi"])
7575
tu.reparse()
7676
spellings = [c.spelling for c in tu.cursor.get_children()]
@@ -150,21 +150,21 @@ def eq(expected, actual):
150150
else:
151151
self.assert_normpaths_equal(expected[1], actual.include.name)
152152

153-
src = os.path.join(k_inputs_dir, "include.cpp")
154-
h1 = os.path.join(k_inputs_dir, "header1.h")
155-
h2 = os.path.join(k_inputs_dir, "header2.h")
156-
h3 = os.path.join(k_inputs_dir, "header3.h")
153+
src = os.path.join(inputs_dir, "include.cpp")
154+
h1 = os.path.join(inputs_dir, "header1.h")
155+
h2 = os.path.join(inputs_dir, "header2.h")
156+
h3 = os.path.join(inputs_dir, "header3.h")
157157
inc = [(src, h1), (h1, h3), (src, h2), (h2, h3)]
158158

159159
tu = TranslationUnit.from_source(src)
160160
for i in zip(inc, tu.get_includes()):
161161
eq(i[0], i[1])
162162

163163
def test_inclusion_directive(self):
164-
src = os.path.join(k_inputs_dir, "include.cpp")
165-
h1 = os.path.join(k_inputs_dir, "header1.h")
166-
h2 = os.path.join(k_inputs_dir, "header2.h")
167-
h3 = os.path.join(k_inputs_dir, "header3.h")
164+
src = os.path.join(inputs_dir, "include.cpp")
165+
h1 = os.path.join(inputs_dir, "header1.h")
166+
h2 = os.path.join(inputs_dir, "header2.h")
167+
h3 = os.path.join(inputs_dir, "header3.h")
168168
inc = [h1, h3, h2, h3, h1]
169169

170170
tu = TranslationUnit.from_source(
@@ -244,7 +244,7 @@ def test_load_pathlike(self):
244244
del tu2
245245

246246
def test_index_parse(self):
247-
path = os.path.join(k_inputs_dir, "hello.cpp")
247+
path = os.path.join(inputs_dir, "hello.cpp")
248248
index = Index.create()
249249
tu = index.parse(path)
250250
self.assertIsInstance(tu, TranslationUnit)
@@ -341,15 +341,15 @@ def test_get_tokens_gc(self):
341341
gc.collect() # Just in case.
342342

343343
def test_fail_from_source(self):
344-
path = os.path.join(k_inputs_dir, "non-existent.cpp")
344+
path = os.path.join(inputs_dir, "non-existent.cpp")
345345
try:
346346
tu = TranslationUnit.from_source(path)
347347
except TranslationUnitLoadError:
348348
tu = None
349349
self.assertEqual(tu, None)
350350

351351
def test_fail_from_ast_file(self):
352-
path = os.path.join(k_inputs_dir, "non-existent.ast")
352+
path = os.path.join(inputs_dir, "non-existent.ast")
353353
try:
354354
tu = TranslationUnit.from_ast_file(path)
355355
except TranslationUnitLoadError:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from .util import get_cursor, get_cursors, get_tu
2020

21-
k_input = """\
21+
struct_input = """\
2222
2323
typedef int I;
2424
@@ -45,7 +45,7 @@
4545

4646
class TestType(unittest.TestCase):
4747
def test_a_struct(self):
48-
tu = get_tu(k_input)
48+
tu = get_tu(struct_input)
4949

5050
teststruct = get_cursor(tu, "teststruct")
5151
self.assertIsNotNone(teststruct, "Could not find teststruct.")

0 commit comments

Comments
 (0)