2020}
2121code_sample = """\
2222
23- class C1() :
23+ class C1:
2424 # Class comment.
2525 def __init__(self, a, b):
2626 self.a = a
@@ -178,29 +178,29 @@ def test_get_context(self):
178178 with self .assertRaises (AssertionError ):
179179 gc (1 , stopline = 0 )
180180
181- eq (gc (3 ), ([(2 , 0 , 'class C1() :' , 'class' )], 0 ))
181+ eq (gc (3 ), ([(2 , 0 , 'class C1:' , 'class' )], 0 ))
182182
183183 # Don't return comment.
184- eq (gc (4 ), ([(2 , 0 , 'class C1() :' , 'class' )], 0 ))
184+ eq (gc (4 ), ([(2 , 0 , 'class C1:' , 'class' )], 0 ))
185185
186186 # Two indentation levels and no comment.
187- eq (gc (5 ), ([(2 , 0 , 'class C1() :' , 'class' ),
187+ eq (gc (5 ), ([(2 , 0 , 'class C1:' , 'class' ),
188188 (4 , 4 , ' def __init__(self, a, b):' , 'def' )], 0 ))
189189
190190 # Only one 'def' is returned, not both at the same indent level.
191- eq (gc (10 ), ([(2 , 0 , 'class C1() :' , 'class' ),
191+ eq (gc (10 ), ([(2 , 0 , 'class C1:' , 'class' ),
192192 (7 , 4 , ' def compare(self):' , 'def' ),
193193 (8 , 8 , ' if a > b:' , 'if' )], 0 ))
194194
195195 # With 'elif', also show the 'if' even though it's at the same level.
196- eq (gc (11 ), ([(2 , 0 , 'class C1() :' , 'class' ),
196+ eq (gc (11 ), ([(2 , 0 , 'class C1:' , 'class' ),
197197 (7 , 4 , ' def compare(self):' , 'def' ),
198198 (8 , 8 , ' if a > b:' , 'if' ),
199199 (10 , 8 , ' elif a < b:' , 'elif' )], 0 ))
200200
201201 # Set stop_line to not go back to first line in source code.
202202 # Return includes stop_line.
203- eq (gc (11 , stopline = 2 ), ([(2 , 0 , 'class C1() :' , 'class' ),
203+ eq (gc (11 , stopline = 2 ), ([(2 , 0 , 'class C1:' , 'class' ),
204204 (7 , 4 , ' def compare(self):' , 'def' ),
205205 (8 , 8 , ' if a > b:' , 'if' ),
206206 (10 , 8 , ' elif a < b:' , 'elif' )], 0 ))
@@ -240,37 +240,37 @@ def test_update_code_context(self):
240240 # Scroll down to line 2.
241241 cc .text .yview (2 )
242242 cc .update_code_context ()
243- eq (cc .info , [(0 , - 1 , '' , False ), (2 , 0 , 'class C1() :' , 'class' )])
243+ eq (cc .info , [(0 , - 1 , '' , False ), (2 , 0 , 'class C1:' , 'class' )])
244244 eq (cc .topvisible , 3 )
245- eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1() :' )
245+ eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1:' )
246246
247247 # Scroll down to line 3. Since it's a comment, nothing changes.
248248 cc .text .yview (3 )
249249 cc .update_code_context ()
250- eq (cc .info , [(0 , - 1 , '' , False ), (2 , 0 , 'class C1() :' , 'class' )])
250+ eq (cc .info , [(0 , - 1 , '' , False ), (2 , 0 , 'class C1:' , 'class' )])
251251 eq (cc .topvisible , 4 )
252- eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1() :' )
252+ eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1:' )
253253
254254 # Scroll down to line 4.
255255 cc .text .yview (4 )
256256 cc .update_code_context ()
257257 eq (cc .info , [(0 , - 1 , '' , False ),
258- (2 , 0 , 'class C1() :' , 'class' ),
258+ (2 , 0 , 'class C1:' , 'class' ),
259259 (4 , 4 , ' def __init__(self, a, b):' , 'def' )])
260260 eq (cc .topvisible , 5 )
261- eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1() :\n '
261+ eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1:\n '
262262 ' def __init__(self, a, b):' )
263263
264264 # Scroll down to line 11. Last 'def' is removed.
265265 cc .text .yview (11 )
266266 cc .update_code_context ()
267267 eq (cc .info , [(0 , - 1 , '' , False ),
268- (2 , 0 , 'class C1() :' , 'class' ),
268+ (2 , 0 , 'class C1:' , 'class' ),
269269 (7 , 4 , ' def compare(self):' , 'def' ),
270270 (8 , 8 , ' if a > b:' , 'if' ),
271271 (10 , 8 , ' elif a < b:' , 'elif' )])
272272 eq (cc .topvisible , 12 )
273- eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1() :\n '
273+ eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1:\n '
274274 ' def compare(self):\n '
275275 ' if a > b:\n '
276276 ' elif a < b:' )
@@ -279,12 +279,12 @@ def test_update_code_context(self):
279279 cc .update_code_context ()
280280 cc .context_depth = 1
281281 eq (cc .info , [(0 , - 1 , '' , False ),
282- (2 , 0 , 'class C1() :' , 'class' ),
282+ (2 , 0 , 'class C1:' , 'class' ),
283283 (7 , 4 , ' def compare(self):' , 'def' ),
284284 (8 , 8 , ' if a > b:' , 'if' ),
285285 (10 , 8 , ' elif a < b:' , 'elif' )])
286286 eq (cc .topvisible , 12 )
287- eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1() :\n '
287+ eq (cc .context .get ('1.0' , 'end-1c' ), 'class C1:\n '
288288 ' def compare(self):\n '
289289 ' if a > b:\n '
290290 ' elif a < b:' )
@@ -293,7 +293,7 @@ def test_update_code_context(self):
293293 cc .text .yview (5 )
294294 cc .update_code_context ()
295295 eq (cc .info , [(0 , - 1 , '' , False ),
296- (2 , 0 , 'class C1() :' , 'class' ),
296+ (2 , 0 , 'class C1:' , 'class' ),
297297 (4 , 4 , ' def __init__(self, a, b):' , 'def' )])
298298 eq (cc .topvisible , 6 )
299299 # context_depth is 1.
@@ -440,7 +440,7 @@ def test_get_line_info(self):
440440 # Line 1 is not a BLOCKOPENER.
441441 eq (gli (lines [0 ]), (codecontext .INFINITY , '' , False ))
442442 # Line 2 is a BLOCKOPENER without an indent.
443- eq (gli (lines [1 ]), (0 , 'class C1() :' , 'class' ))
443+ eq (gli (lines [1 ]), (0 , 'class C1:' , 'class' ))
444444 # Line 3 is not a BLOCKOPENER and does not return the indent level.
445445 eq (gli (lines [2 ]), (codecontext .INFINITY , ' # Class comment.' , False ))
446446 # Line 4 is a BLOCKOPENER and is indented.
0 commit comments