Skip to content

Commit a3b292b

Browse files
committed
Resolve comments
1 parent 9a168a9 commit a3b292b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,7 +2115,7 @@ class TestWindowsConsoleEolWrap(TestCase):
21152115
We use _has_wrapped_to_next_row() to determine the actual behavior.
21162116
"""
21172117

2118-
def _make_console_like(self, *, width: int, offset: int, vt: bool):
2118+
def _make_console_like(self, *, width: int, vt: bool):
21192119
from _pyrepl import windows_console as wc
21202120

21212121
con = object.__new__(wc.WindowsConsole)
@@ -2124,7 +2124,7 @@ def _make_console_like(self, *, width: int, offset: int, vt: bool):
21242124
con.width = width
21252125
con.screen = []
21262126
con.posxy = (0, 0)
2127-
setattr(con, "_WindowsConsole__offset", offset)
2127+
setattr(con, "_WindowsConsole__offset", 0)
21282128
setattr(con, "_WindowsConsole__vt_support", vt)
21292129

21302130
# Stub out side-effecting methods used by __write_changed_line()
@@ -2139,7 +2139,7 @@ def _make_console_like(self, *, width: int, offset: int, vt: bool):
21392139
def _run_exact_width_case(self, *, vt: bool, did_wrap: bool):
21402140
width = 10
21412141
y = 3
2142-
con, wc = self._make_console_like(width=width, offset=0, vt=vt)
2142+
con, wc = self._make_console_like(width=width, vt=vt)
21432143

21442144
with patch.object(con, "_has_wrapped_to_next_row", return_value=did_wrap):
21452145
old = ""
@@ -2166,35 +2166,33 @@ def test_exact_width_line_did_not_wrap_vt_and_legacy(self):
21662166

21672167
@skipUnless(sys.platform == "win32", "Windows console behavior only")
21682168
class TestHasWrappedToNextRow(TestCase):
2169-
def _make_console_like(self, *, offset: int):
2169+
def _make_console_like(self):
21702170
from _pyrepl import windows_console as wc
21712171

21722172
con = object.__new__(wc.WindowsConsole)
2173-
setattr(con, "_WindowsConsole__offset", offset)
2173+
setattr(con, "_WindowsConsole__offset", 0)
21742174
return con, wc
21752175

21762176
def test_returns_true_when_wrapped(self):
2177-
con, wc = self._make_console_like(offset=0)
2177+
con, wc = self._make_console_like()
21782178
y = 3
21792179

21802180
def fake_gcsbi(_h, info):
21812181
info.srWindow.Top = 0
21822182
info.dwCursorPosition.Y = y + 1
21832183
return True
21842184

2185-
with patch.object(wc, "GetConsoleScreenBufferInfo", side_effect=fake_gcsbi), \
2186-
patch.object(wc, "OutHandle", 1):
2187-
self.assertIs(con._has_wrapped_to_next_row(y), True)
2185+
with patch.object(wc, "GetConsoleScreenBufferInfo", side_effect=fake_gcsbi):
2186+
self.assertTrue(con._has_wrapped_to_next_row(y))
21882187

21892188
def test_returns_false_when_not_wrapped(self):
2190-
con, wc = self._make_console_like(offset=0)
2189+
con, wc = self._make_console_like()
21912190
y = 3
21922191

21932192
def fake_gcsbi(_h, info):
21942193
info.srWindow.Top = 0
21952194
info.dwCursorPosition.Y = y
21962195
return True
21972196

2198-
with patch.object(wc, "GetConsoleScreenBufferInfo", side_effect=fake_gcsbi), \
2199-
patch.object(wc, "OutHandle", 1):
2200-
self.assertIs(con._has_wrapped_to_next_row(y), False)
2197+
with patch.object(wc, "GetConsoleScreenBufferInfo", side_effect=fake_gcsbi):
2198+
self.assertFalse(con._has_wrapped_to_next_row(y))

0 commit comments

Comments
 (0)