diff options
author | Steve Graham <stgraham2000@gmail.com> | 2020-03-30 11:21:24 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-10-13 18:29:54 -0700 |
commit | 6472e3ee92f9f091ac0e22a870f6ece1a7d272b0 (patch) | |
tree | 1ff594041694ab515ee1884530d37acc5086f185 /tests/test_utils.py | |
parent | 4aabded1badf94b1de8bb939f11cbebcdd94a22e (diff) | |
download | click-6472e3ee92f9f091ac0e22a870f6ece1a7d272b0.tar.gz |
ensure prompt default is cast to type
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index a588904..a5dfbb8 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -210,6 +210,13 @@ def test_echo_color_flag(monkeypatch, capfd): assert out == f"{text}\n" +def test_prompt_cast_default(capfd, monkeypatch): + monkeypatch.setattr(sys, "stdin", StringIO("\n")) + value = click.prompt("value", default="100", type=int) + capfd.readouterr() + assert type(value) is int + + @pytest.mark.skipif(WIN, reason="Test too complex to make work windows.") def test_echo_writing_to_standard_error(capfd, monkeypatch): def emulate_input(text): |