Skip to content

Commit 28786c7

Browse files
committed
Merge branch 'ansi-to-win32' of https://github.com/Textualize/rich into ansi-to-win32
2 parents 80912a5 + 7525377 commit 28786c7

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

tests/test_win32_console.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,14 @@ def test_write_styled(_, SetConsoleTextAttribute, win32_handle):
8383

8484
assert f.getvalue() == text
8585
# Ensure we set the text attributes and then reset them after writing styled text
86-
assert call_args[0].args == (win32_handle,)
87-
assert call_args[0].kwargs["attributes"].value == 64
88-
assert call_args[1] == call(win32_handle, attributes=DEFAULT_STYLE_ATTRIBUTE)
86+
87+
first_args, first_kwargs = call_args[0]
88+
second_args, second_kwargs = call_args[1]
89+
90+
assert first_args == (win32_handle,)
91+
assert first_kwargs["attributes"].value == 64
92+
assert second_args == (win32_handle,)
93+
assert second_kwargs["attributes"] == DEFAULT_STYLE_ATTRIBUTE
8994

9095
@patch.object(_win32_console, "FillConsoleOutputCharacter", return_value=None)
9196
@patch.object(_win32_console, "FillConsoleOutputAttribute", return_value=None)
@@ -294,8 +299,10 @@ def test_hide_cursor(_, SetConsoleCursorInfo, win32_handle):
294299
call_args = SetConsoleCursorInfo.call_args_list
295300

296301
assert len(call_args) == 1
297-
assert call_args[0].kwargs["cursor_info"].bVisible == 0
298-
assert call_args[0].kwargs["cursor_info"].dwSize == 100
302+
303+
args, kwargs = call_args[0]
304+
assert kwargs["cursor_info"].bVisible == 0
305+
assert kwargs["cursor_info"].dwSize == 100
299306

300307
@patch.object(_win32_console, "SetConsoleCursorInfo", return_value=None)
301308
@patch.object(
@@ -308,8 +315,10 @@ def test_show_cursor(_, SetConsoleCursorInfo, win32_handle):
308315
call_args = SetConsoleCursorInfo.call_args_list
309316

310317
assert len(call_args) == 1
311-
assert call_args[0].kwargs["cursor_info"].bVisible == 1
312-
assert call_args[0].kwargs["cursor_info"].dwSize == 100
318+
319+
args, kwargs = call_args[0]
320+
assert kwargs["cursor_info"].bVisible == 1
321+
assert kwargs["cursor_info"].dwSize == 100
313322

314323
@patch.object(_win32_console, "SetConsoleTitle", return_value=None)
315324
def test_set_title(SetConsoleTitle):

0 commit comments

Comments
 (0)