From 6bac7ffb86b38835ed45f9bfeb2e1d291daeaf81 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 9 Jan 2021 16:20:17 +0000 Subject: [PATCH] no color test --- CHANGELOG.md | 1 + tests/test_console.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8378b72..acb53b13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added rich.tree +- Added no_color argument to Console ## [9.6.2] - 2021-01-07 diff --git a/tests/test_console.py b/tests/test_console.py index b82c7659..82bc5b48 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -467,3 +467,14 @@ def test_console_style() -> None: expected = "\x1b[31mfoo\x1b[0m\n" result = console.file.getvalue() assert result == expected + + +def test_no_color(): + console = Console( + file=io.StringIO(), color_system="truecolor", force_terminal=True, no_color=True + ) + console.print("[bold magenta on red]FOO") + expected = "\x1b[1mFOO\x1b[0m\n" + result = console.file.getvalue() + print(repr(result)) + assert result == expected