MCPcopy
hub / github.com/Textualize/rich / test_write_styled_reverse

Function test_write_styled_reverse

tests/test_win32_console.py:123–137  ·  view source on GitHub ↗
(
        SetConsoleTextAttribute, win32_console_getters, win32_handle
    )

Source from the content-addressed store, hash-verified

121
122 @patch.object(_win32_console, "SetConsoleTextAttribute")
123 def test_write_styled_reverse(
124 SetConsoleTextAttribute, win32_console_getters, win32_handle
125 ):
126 style = Style.parse("reverse red on blue")
127 text = "Hello, world!"
128 term = LegacyWindowsTerm(sys.stdout)
129
130 term.write_styled(text, style)
131
132 call_args = SetConsoleTextAttribute.call_args_list
133 first_args, first_kwargs = call_args[0]
134
135 expected_attr = 64 + 1 # 64 for red bg (after reverse), +1 for blue fg
136 assert first_args == (win32_handle,)
137 assert first_kwargs["attributes"].value == expected_attr
138
139 @patch.object(_win32_console, "SetConsoleTextAttribute")
140 def test_write_styled_reverse(

Callers

nothing calls this directly

Calls 3

write_styledMethod · 0.95
LegacyWindowsTermClass · 0.90
parseMethod · 0.45

Tested by

no test coverage detected