| 292 | self.text.delete('1.0', 'end') |
| 293 | |
| 294 | def test_long_line(self): |
| 295 | text = self.text |
| 296 | |
| 297 | # Set cursor ('insert' mark) to '1.0', within text. |
| 298 | text.insert('1.0', self.test_string) |
| 299 | text.mark_set('insert', '1.0') |
| 300 | self.formatter('ParameterDoesNothing', limit=70) |
| 301 | result = text.get('1.0', 'insert') |
| 302 | # find function includes \n |
| 303 | expected = ( |
| 304 | " '''this is a test of a reformat for a triple quoted string will it\n" |
| 305 | " reformat to less than 70 characters for me?'''\n") # yes |
| 306 | self.assertEqual(result, expected) |
| 307 | text.delete('1.0', 'end') |
| 308 | |
| 309 | # Select from 1.11 to line end. |
| 310 | text.insert('1.0', self.test_string) |
| 311 | text.tag_add('sel', '1.11', '1.end') |
| 312 | self.formatter('ParameterDoesNothing', limit=70) |
| 313 | result = text.get('1.0', 'insert') |
| 314 | # selection excludes \n |
| 315 | expected = ( |
| 316 | " '''this is a test of a reformat for a triple quoted string will it reformat\n" |
| 317 | " to less than 70 characters for me?'''") # no |
| 318 | self.assertEqual(result, expected) |
| 319 | text.delete('1.0', 'end') |
| 320 | |
| 321 | def test_multiple_lines(self): |
| 322 | text = self.text |