| 47 | @patch.object(WindowsConsole, '__init__', _mock_console_init) |
| 48 | class 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, |