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

Method test_view

Lib/idlelib/idle_test/test_squeezer.py:431–446  ·  view source on GitHub ↗

Test the view event.

(self)

Source from the content-addressed store, hash-verified

429 expandingbutton.clipboard_append.assert_called_with('TEXT')
430
431 def test_view(self):
432 """Test the view event."""
433 squeezer = self.make_mock_squeezer()
434 expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer)
435 expandingbutton.selection_own = Mock()
436
437 with patch('idlelib.squeezer.view_text', autospec=view_text)\
438 as mock_view_text:
439 # Trigger the view event.
440 expandingbutton.view(event=Mock())
441
442 # Check that the expanding button called view_text.
443 self.assertEqual(mock_view_text.call_count, 1)
444
445 # Check that the proper text was passed.
446 self.assertEqual(mock_view_text.call_args[0][2], 'TEXT')
447
448 def test_rmenu(self):
449 """Test the context menu."""

Callers

nothing calls this directly

Calls 6

make_mock_squeezerMethod · 0.95
viewMethod · 0.95
ExpandingButtonClass · 0.90
MockClass · 0.90
patchFunction · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected