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

Function test_soft_wrap_styled

tests/test_text.py:1115–1129  ·  view source on GitHub ↗

Regression test for https://github.com/Textualize/rich/issues/3838 If soft_wrap is True and a style is set, we don't want to style the new lines.

()

Source from the content-addressed store, hash-verified

1113
1114
1115def test_soft_wrap_styled() -> None:
1116 """Regression test for https://github.com/Textualize/rich/issues/3838
1117
1118 If soft_wrap is True and a style is set, we don't want to style the new lines.
1119 """
1120 console = Console(color_system="standard", width=80, force_terminal=True)
1121 with console.capture() as capture:
1122 console.print("soft wrap is on", style="blue on white", soft_wrap=True)
1123 console.print("Next line")
1124
1125 output = capture.get()
1126 print(repr(output))
1127 # Background is reset before \n
1128 expected = "\x1b[34;47msoft wrap is on\x1b[0m\nNext line\n"
1129 assert output == expected

Callers

nothing calls this directly

Calls 5

captureMethod · 0.95
printMethod · 0.95
ConsoleClass · 0.90
printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected