2222
2323from .util import get_cursor , get_cursors , get_tu
2424
25- children_test = """\
25+ CHILDREN_TEST = """\
2626 struct s0 {
2727 int a;
2828 int b;
4242}
4343"""
4444
45- parent_test = """\
45+ PARENT_TEST = """\
4646 class C {
4747 void f();
4848 }
4949
5050 void C::f() { }
5151 """
5252
53- template_arg_test = """\
53+ TEMPLATE_ARG_TEST = """\
5454 template <int kInt, typename T, bool kBool>
5555 void foo();
5656
5757 template<>
5858 void foo<-7, float, true>();
5959 """
6060
61- binops = """\
61+ BINOPS = """\
6262 struct C {
6363 int m;
6464 };
@@ -119,7 +119,7 @@ class C {
119119
120120class TestCursor (unittest .TestCase ):
121121 def test_get_children (self ):
122- tu = get_tu (children_test )
122+ tu = get_tu (CHILDREN_TEST )
123123
124124 it = tu .cursor .get_children ()
125125 tu_nodes = list (it )
@@ -614,15 +614,15 @@ def test_underlying_type(self):
614614 self .assertEqual (underlying .kind , TypeKind .INT )
615615
616616 def test_semantic_parent (self ):
617- tu = get_tu (parent_test , "cpp" )
617+ tu = get_tu (PARENT_TEST , "cpp" )
618618 curs = get_cursors (tu , "f" )
619619 decl = get_cursor (tu , "C" )
620620 self .assertEqual (len (curs ), 2 )
621621 self .assertEqual (curs [0 ].semantic_parent , curs [1 ].semantic_parent )
622622 self .assertEqual (curs [0 ].semantic_parent , decl )
623623
624624 def test_lexical_parent (self ):
625- tu = get_tu (parent_test , "cpp" )
625+ tu = get_tu (PARENT_TEST , "cpp" )
626626 curs = get_cursors (tu , "f" )
627627 decl = get_cursor (tu , "C" )
628628 self .assertEqual (len (curs ), 2 )
@@ -866,13 +866,13 @@ def test_get_arguments(self):
866866 self .assertEqual (arguments [1 ].spelling , "j" )
867867
868868 def test_get_num_template_arguments (self ):
869- tu = get_tu (template_arg_test , lang = "cpp" )
869+ tu = get_tu (TEMPLATE_ARG_TEST , lang = "cpp" )
870870 foos = get_cursors (tu , "foo" )
871871
872872 self .assertEqual (foos [1 ].get_num_template_arguments (), 3 )
873873
874874 def test_get_template_argument_kind (self ):
875- tu = get_tu (template_arg_test , lang = "cpp" )
875+ tu = get_tu (TEMPLATE_ARG_TEST , lang = "cpp" )
876876 foos = get_cursors (tu , "foo" )
877877
878878 self .assertEqual (
@@ -886,20 +886,20 @@ def test_get_template_argument_kind(self):
886886 )
887887
888888 def test_get_template_argument_type (self ):
889- tu = get_tu (template_arg_test , lang = "cpp" )
889+ tu = get_tu (TEMPLATE_ARG_TEST , lang = "cpp" )
890890 foos = get_cursors (tu , "foo" )
891891
892892 self .assertEqual (foos [1 ].get_template_argument_type (1 ).kind , TypeKind .FLOAT )
893893
894894 def test_get_template_argument_value (self ):
895- tu = get_tu (template_arg_test , lang = "cpp" )
895+ tu = get_tu (TEMPLATE_ARG_TEST , lang = "cpp" )
896896 foos = get_cursors (tu , "foo" )
897897
898898 self .assertEqual (foos [1 ].get_template_argument_value (0 ), - 7 )
899899 self .assertEqual (foos [1 ].get_template_argument_value (2 ), True )
900900
901901 def test_get_template_argument_unsigned_value (self ):
902- tu = get_tu (template_arg_test , lang = "cpp" )
902+ tu = get_tu (TEMPLATE_ARG_TEST , lang = "cpp" )
903903 foos = get_cursors (tu , "foo" )
904904
905905 self .assertEqual (foos [1 ].get_template_argument_unsigned_value (0 ), 2 ** 32 - 7 )
@@ -931,7 +931,7 @@ def test_mangled_name(self):
931931 )
932932
933933 def test_binop (self ):
934- tu = get_tu (binops , lang = "cpp" )
934+ tu = get_tu (BINOPS , lang = "cpp" )
935935
936936 operators = {
937937 # not exposed yet
@@ -1004,7 +1004,7 @@ def accumulate_cursors(cursor: Cursor, all_cursors: list):
10041004 all_cursors = accumulate_cursors (child , all_cursors )
10051005 return all_cursors
10061006
1007- tu = get_tu (children_test )
1007+ tu = get_tu (CHILDREN_TEST )
10081008 all_cursors = accumulate_cursors (tu .cursor , [])
10091009 cursor_hashes = set ()
10101010 for cursor in all_cursors :
@@ -1028,7 +1028,7 @@ def test_has_attrs(self):
10281028 self .assertFalse (B .get_definition ().has_attrs ())
10291029
10301030 def test_specialized_template (self ):
1031- tu = get_tu (template_arg_test , lang = "cpp" )
1031+ tu = get_tu (TEMPLATE_ARG_TEST , lang = "cpp" )
10321032 foos = get_cursors (tu , "foo" )
10331033 prime_foo = foos [1 ].specialized_template
10341034
0 commit comments