Skip to content

Commit

Permalink
prompt test
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jul 23, 2020
1 parent 70d43d7 commit 6ece06d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6ece06d

Please sign in to comment.