mirror of https://github.com/Textualize/rich.git
22 lines
428 B
Python
22 lines
428 B
Python
import io
|
|
|
|
import rich
|
|
from rich.console import Console
|
|
|
|
|
|
def test_get_console():
|
|
console = rich.get_console()
|
|
assert isinstance(console, Console)
|
|
|
|
|
|
def test_rich_print():
|
|
console = rich.get_console()
|
|
output = io.StringIO()
|
|
backup_file = console.file
|
|
try:
|
|
console.file = output
|
|
rich.print("foo")
|
|
assert output.getvalue() == "foo\n"
|
|
finally:
|
|
console.file = backup_file
|