Skip to content

Commit b2b78a8

Browse files
committed
Resolved comments
1 parent 4a84421 commit b2b78a8

File tree

3 files changed

+3
-32
lines changed

3 files changed

+3
-32
lines changed

Lib/_pyrepl/windows_console.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,9 @@ def input_hook(self):
247247
if nt is not None and nt._is_inputhook_installed():
248248
return nt._inputhook
249249

250-
def _has_wrapped_to_next_row(self, y: int) -> bool | None:
250+
def _has_wrapped_to_next_row(self, y: int) -> bool:
251251
"""
252-
Return whether the real console cursor wrapped to the next row.
253-
254-
Returns:
255-
True - cursor wrapped to the next visible row
256-
False - cursor did not wrap
257-
None - cannot query the real cursor position (e.g. invalid handle)
252+
Return True if the real console cursor wrapped to the next visible row.
258253
"""
259254
info = CONSOLE_SCREEN_BUFFER_INFO()
260255
if not GetConsoleScreenBufferInfo(OutHandle, info):

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,28 +2205,3 @@ def fake_gcsbi(_h, info):
22052205
with patch.object(wc, "GetConsoleScreenBufferInfo", side_effect=fake_gcsbi), \
22062206
patch.object(wc, "OutHandle", 1):
22072207
self.assertIs(con._has_wrapped_to_next_row(y), False)
2208-
2209-
def test_returns_none_on_invalid_handle(self):
2210-
con, wc = self._make_console_like(offset=0)
2211-
y = 3
2212-
2213-
def fake_gcsbi(_h, info):
2214-
return False
2215-
2216-
with patch.object(wc, "GetConsoleScreenBufferInfo", side_effect=fake_gcsbi), \
2217-
patch.object(wc, "OutHandle", 1), \
2218-
patch.object(wc, "get_last_error", return_value=6): # ERROR_INVALID_HANDLE
2219-
self.assertIs(con._has_wrapped_to_next_row(y), None)
2220-
2221-
def test_raises_on_unexpected_error(self):
2222-
con, wc = self._make_console_like(offset=0)
2223-
y = 3
2224-
2225-
def fake_gcsbi(_h, info):
2226-
return False
2227-
2228-
with patch.object(wc, "GetConsoleScreenBufferInfo", side_effect=fake_gcsbi), \
2229-
patch.object(wc, "OutHandle", 1), \
2230-
patch.object(wc, "get_last_error", return_value=5): # ERROR_ACCESS_DENIED
2231-
with self.assertRaises(OSError):
2232-
con._has_wrapped_to_next_row(y)

Lib/test/test_pyrepl/test_windows_console.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def console(self, events, **kwargs) -> Console:
4141
console._hide_cursor = MagicMock()
4242
console._show_cursor = MagicMock()
4343
console._getscrollbacksize = MagicMock(42)
44+
console._has_wrapped_to_next_row = MagicMock(return_value=False)
4445
console.out = MagicMock()
4546

4647
height = kwargs.get("height", 25)

0 commit comments

Comments
 (0)