MCPcopy Index your code
hub / github.com/python/cpython / test_comment_block

Method test_comment_block

Lib/idlelib/idle_test/test_format.py:336–362  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

334 text.delete('1.0', 'end')
335
336 def test_comment_block(self):
337 text = self.text
338
339 # Set cursor ('insert') to '1.0', within block.
340 text.insert('1.0', self.multiline_test_comment)
341 self.formatter('ParameterDoesNothing', limit=70)
342 result = text.get('1.0', 'insert')
343 expected = (
344"# The first line is under the max width. The second line's length is\n"
345"# way over the max width. It goes on and on until it is over 100\n"
346"# characters long. Same thing with the third line. It is also way over\n"
347"# the max width, but FormatParagraph will fix it. The fourth line is\n"
348"# short like the first line.\n")
349 self.assertEqual(result, expected)
350 text.delete('1.0', 'end')
351
352 # Select line 2, verify line 1 unaffected.
353 text.insert('1.0', self.multiline_test_comment)
354 text.tag_add('sel', '2.0', '3.0')
355 self.formatter('ParameterDoesNothing', limit=70)
356 result = text.get('1.0', 'insert')
357 expected = (
358"# The first line is under the max width.\n"
359"# The second line's length is way over the max width. It goes on and\n"
360"# on until it is over 100 characters long.\n")
361 self.assertEqual(result, expected)
362 text.delete('1.0', 'end')
363
364# The following block worked with EditorWindow but fails with the mock.
365# Lines 2 and 3 get pasted together even though the previous block left

Callers

nothing calls this directly

Calls 5

tag_addMethod · 0.80
insertMethod · 0.45
getMethod · 0.45
assertEqualMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected