From 6df310f46b27564945dfc19af36243a78961999d Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 19 Apr 2020 14:59:10 +0100 Subject: [PATCH] test rich print --- tests/test_rich_print.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_rich_print.py diff --git a/tests/test_rich_print.py b/tests/test_rich_print.py new file mode 100644 index 00000000..c8e21ec5 --- /dev/null +++ b/tests/test_rich_print.py @@ -0,0 +1,19 @@ +import io +import sys + +import rich +from rich.console import Console + + +def test_rich_print(): + output = io.StringIO() + + assert rich._console is None + backup_file = sys.stdout + try: + sys.stdout = output + rich.print("foo") + assert isinstance(rich._console, Console) + assert output.getvalue() == "foo\n" + finally: + sys.stdout = backup_file