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

Function test_wrap_cjk_mixed

tests/test_text.py:505–516  ·  view source on GitHub ↗

Regression test covering https://github.com/Textualize/rich/issues/3176 and https://github.com/Textualize/textual/issues/3567 - double width characters could result in text going missing when wrapping.

()

Source from the content-addressed store, hash-verified

503
504
505def test_wrap_cjk_mixed():
506 """Regression test covering https://github.com/Textualize/rich/issues/3176 and
507 https://github.com/Textualize/textual/issues/3567 - double width characters could
508 result in text going missing when wrapping."""
509 text = Text("123ありがとうございました")
510 console = Console(width=20) # let's ensure the width passed to wrap() wins.
511
512 wrapped_lines = text.wrap(console, width=8)
513 with console.capture() as capture:
514 console.print(wrapped_lines)
515
516 assert capture.get() == "123あり\nがとうご\nざいまし\nた\n"
517
518
519def test_wrap_long():

Callers

nothing calls this directly

Calls 6

wrapMethod · 0.95
captureMethod · 0.95
printMethod · 0.95
TextClass · 0.90
ConsoleClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected