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

Method console

Lib/test/test_pyrepl/test_windows_console.py:49–67  ·  view source on GitHub ↗
(self, events, **kwargs)

Source from the content-addressed store, hash-verified

47@patch.object(WindowsConsole, '__init__', _mock_console_init)
48class WindowsConsoleTests(TestCase):
49 def console(self, events, **kwargs) -> Console:
50 console = WindowsConsole()
51 console.get_event = MagicMock(side_effect=events)
52 console.getpending = MagicMock(return_value=Event("key", ""))
53 console.wait = MagicMock()
54 console._scroll = MagicMock()
55 console._hide_cursor = MagicMock()
56 console._show_cursor = MagicMock()
57 console._getscrollbacksize = MagicMock(42)
58 console.out = MagicMock()
59
60 height = kwargs.get("height", 25)
61 width = kwargs.get("width", 80)
62 console.getheightwidth = MagicMock(side_effect=lambda: (height, width))
63
64 console.prepare()
65 for key, val in kwargs.items():
66 setattr(console, key, val)
67 return console
68
69 def handle_events(
70 self,

Callers

nothing calls this directly

Calls 6

prepareMethod · 0.95
WindowsConsoleClass · 0.90
MagicMockClass · 0.90
EventClass · 0.90
getMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected