summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoachim Jablon <ewjoachim@gmail.com>2020-05-10 00:53:26 +0200
committerDavid Lord <davidism@gmail.com>2020-10-11 18:43:30 -0700
commit54102a439da9da4a2c84cd893b12020865b9afd3 (patch)
treeb3b18b088bc1cf2ca4d83c0d60cd5972a8b03d34 /tests
parentc067af761a70a6cbb91fa49083a41511207297da (diff)
downloadclick-54102a439da9da4a2c84cd893b12020865b9afd3.tar.gz
show_default uses default_map
Diffstat (limited to 'tests')
-rw-r--r--tests/test_options.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_options.py b/tests/test_options.py
index 2e50594..eea68c1 100644
--- a/tests/test_options.py
+++ b/tests/test_options.py
@@ -188,6 +188,18 @@ def test_multiple_default_help(runner):
assert "1, 2" in result.output
+def test_show_default_default_map(runner):
+ @click.command()
+ @click.option("--arg", default="a", show_default=True)
+ def cmd(arg):
+ click.echo(arg)
+
+ result = runner.invoke(cmd, ["--help"], default_map={"arg": "b"})
+
+ assert not result.exception
+ assert "[default: b]" in result.output
+
+
def test_multiple_default_type():
opt = click.Option(["-a"], multiple=True, default=(1, 2))
assert opt.nargs == 1