Test the copy event.
(self)
| 409 | self.assertEqual(expandingbutton.text.get('1.0', 'end-1c'), text) |
| 410 | |
| 411 | def test_copy(self): |
| 412 | """Test the copy event.""" |
| 413 | # Testing with the actual clipboard proved problematic, so this |
| 414 | # test replaces the clipboard manipulation functions with mocks |
| 415 | # and checks that they are called appropriately. |
| 416 | squeezer = self.make_mock_squeezer() |
| 417 | expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) |
| 418 | expandingbutton.clipboard_clear = Mock() |
| 419 | expandingbutton.clipboard_append = Mock() |
| 420 | |
| 421 | # Trigger the copy event. |
| 422 | retval = expandingbutton.copy(event=Mock()) |
| 423 | self.assertEqual(retval, None) |
| 424 | |
| 425 | # Vheck that the expanding button called clipboard_clear() and |
| 426 | # clipboard_append('TEXT') once each. |
| 427 | self.assertEqual(expandingbutton.clipboard_clear.call_count, 1) |
| 428 | self.assertEqual(expandingbutton.clipboard_append.call_count, 1) |
| 429 | expandingbutton.clipboard_append.assert_called_with('TEXT') |
| 430 | |
| 431 | def test_view(self): |
| 432 | """Test the view event.""" |
nothing calls this directly
no test coverage detected