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

Method test_rmenu

Lib/idlelib/idle_test/test_squeezer.py:448–462  ·  view source on GitHub ↗

Test the context menu.

(self)

Source from the content-addressed store, hash-verified

446 self.assertEqual(mock_view_text.call_args[0][2], 'TEXT')
447
448 def test_rmenu(self):
449 """Test the context menu."""
450 squeezer = self.make_mock_squeezer()
451 expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer)
452 with patch('tkinter.Menu') as mock_Menu:
453 mock_menu = Mock()
454 mock_Menu.return_value = mock_menu
455 mock_event = Mock()
456 mock_event.x = 10
457 mock_event.y = 10
458 expandingbutton.context_menu_event(event=mock_event)
459 self.assertEqual(mock_menu.add_command.call_count,
460 len(expandingbutton.rmenu_specs))
461 for label, *data in expandingbutton.rmenu_specs:
462 mock_menu.add_command.assert_any_call(label=label, command=ANY)
463
464
465if __name__ == '__main__':

Callers

nothing calls this directly

Calls 7

make_mock_squeezerMethod · 0.95
context_menu_eventMethod · 0.95
ExpandingButtonClass · 0.90
patchFunction · 0.90
MockClass · 0.90
assert_any_callMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected