mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 10:08:40 +00:00
prompt test
This commit is contained in:
parent
70d43d7c92
commit
6ece06d960
1 changed files with 12 additions and 0 deletions
|
@ -68,3 +68,15 @@ def test_prompt_confirm_yes():
|
|||
print(repr(output))
|
||||
assert output == expected
|
||||
|
||||
|
||||
def test_prompt_confirm_default():
|
||||
INPUT = "foo\nNO\ny"
|
||||
console = Console(file=io.StringIO())
|
||||
answer = Confirm.ask(
|
||||
"continue", console=console, stream=io.StringIO(INPUT), default=True
|
||||
)
|
||||
assert answer is True
|
||||
expected = "continue [y/n] (y): Please enter Y or N\ncontinue [y/n] (y): Please enter Y or N\ncontinue [y/n] (y): "
|
||||
output = console.file.getvalue()
|
||||
print(repr(output))
|
||||
assert output == expected
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue