@@ -58,6 +58,18 @@ def test_find_good_parse_start(self):
58
58
p = self .parser
59
59
setcode = p .set_code
60
60
start = p .find_good_parse_start
61
+ def char_in_string_false (index ): return False
62
+
63
+ # First line starts with 'def' and ends with ':', then 0 is the pos.
64
+ setcode ('def spam():\n ' )
65
+ eq (start (char_in_string_false ), 0 )
66
+
67
+ # First line begins with a keyword in the list and ends
68
+ # with an open brace, then 0 is the pos. This is how
69
+ # hyperparser calls this function as the newline is not added
70
+ # in the editor, but rather on the call to setcode.
71
+ setcode ('class spam( ' + ' \n ' )
72
+ eq (start (char_in_string_false ), 0 )
61
73
62
74
# Split def across lines.
63
75
setcode ('"""This is a module docstring"""\n '
@@ -79,7 +91,7 @@ def test_find_good_parse_start(self):
79
91
80
92
# Make all text look like it's not in a string. This means that it
81
93
# found a good start position.
82
- eq (start (is_char_in_string = lambda index : False ), 44 )
94
+ eq (start (char_in_string_false ), 44 )
83
95
84
96
# If the beginning of the def line is not in a string, then it
85
97
# returns that as the index.
@@ -98,7 +110,7 @@ def test_find_good_parse_start(self):
98
110
' def __init__(self, a, b=True):\n '
99
111
' pass\n '
100
112
)
101
- eq (start (is_char_in_string = lambda index : False ), 44 )
113
+ eq (start (char_in_string_false ), 44 )
102
114
eq (start (is_char_in_string = lambda index : index > 44 ), 44 )
103
115
eq (start (is_char_in_string = lambda index : index >= 44 ), 33 )
104
116
# When the def line isn't split, this returns which doesn't match the
0 commit comments