summaryrefslogtreecommitdiff
path: root/tests/test_options.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_options.py')
-rw-r--r--tests/test_options.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_options.py b/tests/test_options.py
index 2e34337..90616b7 100644
--- a/tests/test_options.py
+++ b/tests/test_options.py
@@ -305,6 +305,19 @@ def test_dynamic_default_help_text(runner):
assert "(current user)" in result.output
+def test_dynamic_default_help_special_method(runner):
+ class Value:
+ def __call__(self):
+ return 42
+
+ def __str__(self):
+ return "special value"
+
+ opt = click.Option(["-a"], default=Value(), show_default=True)
+ ctx = click.Context(click.Command("cli"))
+ assert "special value" in opt.get_help_record(ctx)[1]
+
+
@pytest.mark.parametrize(
("type", "expect"),
[