blob: 8ebe5e8d3f34fca2c02f164739a7392d0ac88e33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
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)
assert Measurement.get(console, styled_foo, 80) == Measurement(3, 3)
console.print(styled_foo)
result = console.file.getvalue()
expected = "\x1b[41mfoo\x1b[0m\n"
assert result == expected
|