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

Function test_write_styled_bold

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

Source from the content-addressed store, hash-verified

104
105 @patch.object(_win32_console, "SetConsoleTextAttribute")
106 def test_write_styled_bold(
107 SetConsoleTextAttribute, win32_console_getters, win32_handle
108 ):
109 style = Style.parse("bold black on red")
110 text = "Hello, world!"
111 term = LegacyWindowsTerm(sys.stdout)
112
113 term.write_styled(text, style)
114
115 call_args = SetConsoleTextAttribute.call_args_list
116 first_args, first_kwargs = call_args[0]
117
118 expected_attr = 64 + 8 # 64 for red bg, +8 for bright black
119 assert first_args == (win32_handle,)
120 assert first_kwargs["attributes"].value == expected_attr
121
122 @patch.object(_win32_console, "SetConsoleTextAttribute")
123 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