no color test

This commit is contained in:
Will McGugan 2021-01-09 16:20:17 +00:00
parent c436acfcb0
commit 6bac7ffb86
2 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added rich.tree - Added rich.tree
- Added no_color argument to Console
## [9.6.2] - 2021-01-07 ## [9.6.2] - 2021-01-07

View File

@ -467,3 +467,14 @@ def test_console_style() -> None:
expected = "\x1b[31mfoo\x1b[0m\n" expected = "\x1b[31mfoo\x1b[0m\n"
result = console.file.getvalue() result = console.file.getvalue()
assert result == expected 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