-
-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure rich_markup_mode=None disables rich
As stated in the documentation, rich_markup_mode=None is the default mode. Make sure that this is true even when rich is installed, fix current tests assuming it's on by default, and add new test cases to validate rich_markup_mode options. Signed-off-by: Liam Beguin <liambeguin@gmail.com> 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
- Loading branch information
1 parent
3a7264c
commit 1579346
Showing
7 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import typer | ||
import typer.completion | ||
from typer.testing import CliRunner | ||
|
||
runner = CliRunner() | ||
rounded = ["╭", "─", "┬", "╮", "│", "├", "┼", "┤", "╰", "┴", "╯"] | ||
|
||
|
||
def test_rich_markup_mode_default(): | ||
app = typer.Typer() | ||
|
||
@app.command() | ||
def main(arg: str): | ||
"""Main function""" | ||
print("Hello World") | ||
|
||
assert app.rich_markup_mode == None | ||
|
||
result = runner.invoke(app, ["--help"]) | ||
assert all(c not in result.stdout for c in rounded) | ||
|
||
|
||
def test_rich_markup_mode_rich(): | ||
app = typer.Typer(rich_markup_mode="rich") | ||
|
||
@app.command() | ||
def main(arg: str): | ||
"""Main function""" | ||
print("Hello World") | ||
|
||
assert app.rich_markup_mode == "rich" | ||
|
||
result = runner.invoke(app, ["--help"]) | ||
assert any(c in result.stdout for c in rounded) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters