This commit is contained in:
Will McGugan 2020-11-25 17:54:16 +00:00
parent 966bfb7fc9
commit 5126088a49
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import io
from rich.console import Console
from rich.measure import Measurement
from rich.panel import Panel
import pytest
@ -42,6 +43,14 @@ def test_console_width():
assert max_width == 16
def test_fixed_width():
console = Console(file=io.StringIO(), width=50, legacy_windows=False)
panel = Panel("Hello World", width=20)
min_width, max_width = panel.__rich_measure__(console, 100)
assert min_width == 20
assert max_width == 20
if __name__ == "__main__":
expected = []
for panel in tests: