rich/tests/test_measure.py

20 lines
416 B
Python
Raw Normal View History

2020-08-08 10:47:10 +00:00
from rich.text import Text
import pytest
from rich.errors import NotRenderableError
from rich.console import Console
from rich.measure import Measurement
def test_span():
measurement = Measurement(10, 100)
assert measurement.span == 90
def test_no_renderable():
console = Console()
text = Text()
with pytest.raises(NotRenderableError):
Measurement.get(console, None, console.width)