/
githubmirror
/
rich
Обзор
Документация
Войти
/
githubmirror
/
rich
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/test_styled.py
15 строк
471 B
Will McGugan
rich measure
26 мар 2021, 00:08
26 мар 2021, 00:08
be5e9dc
Код
Авторство
О чём код?
import io from rich.console import Console from rich.measure import Measurement from rich.styled import Styled def test_styled(): styled_foo = Styled("foo", "on red") console = Console(file=io.StringIO(), force_terminal=True, _environ={}) assert Measurement.get(console, console.options, styled_foo) == Measurement(3, 3) console.print(styled_foo) result = console.file.getvalue() expected = "\x1b[41mfoo\x1b[0m\n" assert result == expected