Test the expand event.
(self)
| 347 | self.assertIn('right-click', tooltip_text.lower()) |
| 348 | |
| 349 | def test_expand(self): |
| 350 | """Test the expand event.""" |
| 351 | squeezer = self.make_mock_squeezer() |
| 352 | expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) |
| 353 | |
| 354 | # Insert the button into the text widget |
| 355 | # (this is normally done by the Squeezer class). |
| 356 | text_widget = squeezer.editwin.text |
| 357 | text_widget.window_create("1.0", window=expandingbutton) |
| 358 | |
| 359 | # trigger the expand event |
| 360 | retval = expandingbutton.expand(event=Mock()) |
| 361 | self.assertEqual(retval, None) |
| 362 | |
| 363 | # Check that the text was inserted into the text widget. |
| 364 | self.assertEqual(text_widget.get('1.0', 'end'), 'TEXT\n') |
| 365 | |
| 366 | # Check that the 'TAGS' tag was set on the inserted text. |
| 367 | text_end_index = text_widget.index('end-1c') |
| 368 | self.assertEqual(text_widget.get('1.0', text_end_index), 'TEXT') |
| 369 | self.assertEqual(text_widget.tag_nextrange('TAGS', '1.0'), |
| 370 | ('1.0', text_end_index)) |
| 371 | |
| 372 | # Check that the button removed itself from squeezer.expandingbuttons. |
| 373 | self.assertEqual(squeezer.expandingbuttons.remove.call_count, 1) |
| 374 | squeezer.expandingbuttons.remove.assert_called_with(expandingbutton) |
| 375 | |
| 376 | def test_expand_dangerous_oupput(self): |
| 377 | """Test that expanding very long output asks user for confirmation.""" |
nothing calls this directly
no test coverage detected