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

Function test_soft_wrap

tests/test_text.py:1097–1112  ·  view source on GitHub ↗

Regression test for https://github.com/Textualize/rich/issues/3841 Soft wrap should not strip trailing whitespace.

()

Source from the content-addressed store, hash-verified

1095
1096
1097def test_soft_wrap() -> None:
1098 """Regression test for https://github.com/Textualize/rich/issues/3841
1099
1100 Soft wrap should not strip trailing whitespace.
1101
1102 """
1103 console = Console(color_system="standard", width=80, force_terminal=True)
1104 text = Text(" Hello World ", style="white on blue")
1105
1106 with console.capture() as capture:
1107 console.print(text, soft_wrap=True)
1108
1109 output = capture.get()
1110 print(repr(output))
1111 expected = "\x1b[37;44m Hello World \x1b[0m\n"
1112 assert output == expected
1113
1114
1115def test_soft_wrap_styled() -> None:

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected