mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 18:18:22 +00:00
Fixing coverage
This commit is contained in:
parent
1b217f1da2
commit
428092cf10
1 changed files with 11 additions and 2 deletions
|
@ -2,6 +2,7 @@ import pytest
|
|||
|
||||
from rich.console import Console
|
||||
from rich.measure import Measurement
|
||||
from rich.panel import Panel
|
||||
from rich.spinner import Spinner
|
||||
|
||||
|
||||
|
@ -41,16 +42,24 @@ def test_spinner_update():
|
|||
|
||||
console = Console(width=80, force_terminal=True, get_time=get_time)
|
||||
console.begin_capture()
|
||||
spinner = Spinner("dots", "Foo")
|
||||
spinner = Spinner("dots")
|
||||
console.print(spinner)
|
||||
|
||||
spinner.update(text="Bar", style="green", speed=2)
|
||||
time += 80 / 1000
|
||||
console.print(spinner)
|
||||
|
||||
spinner.update(text=Panel("Bar"))
|
||||
time += 80 / 1000
|
||||
console.print(spinner)
|
||||
|
||||
result = console.end_capture()
|
||||
print(repr(result))
|
||||
expected = f"⠋ Foo\n\x1b[32m⠙\x1b[0m Bar\n\x1b[32m⠸\x1b[0m Bar\n"
|
||||
expected = (
|
||||
f"⠋\n"
|
||||
f"\x1b[32m⠙\x1b[0m Bar\n"
|
||||
f"\x1b[32m⠸\x1b[0m ╭─────╮\n │ Bar │\n ╰─────╯\n"
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue