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

Function test_append_tokens

tests/test_text.py:1066–1083  ·  view source on GitHub ↗

Regression test for https://github.com/Textualize/rich/issues/3014

()

Source from the content-addressed store, hash-verified

1064
1065
1066def test_append_tokens() -> None:
1067 """Regression test for https://github.com/Textualize/rich/issues/3014"""
1068
1069 console = Console()
1070 t = Text().append_tokens(
1071 [
1072 (
1073 "long text that will be wrapped with a control code \r\n",
1074 "red",
1075 ),
1076 ]
1077 )
1078 with console.capture() as capture:
1079 console.print(t, width=40)
1080
1081 output = capture.get()
1082 print(repr(output))
1083 assert output == "long text that will be wrapped with a \ncontrol code \n\n"
1084
1085
1086def test_append_loop_regression() -> None:

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected