diff options
author | David Lord <davidism@gmail.com> | 2022-01-13 11:04:10 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2022-01-13 11:04:10 -0800 |
commit | c63c70dabd3f86ca68678b4f00951f78f52d0270 (patch) | |
tree | fceeff9682963158a9941706ac593fd440a194a0 /tests | |
parent | 051d57cef4ce59212dc1175ad4550743bf47d840 (diff) | |
parent | ee5fdbf1f9e267247d6de765329d2cc9bdd76206 (diff) | |
download | click-c63c70dabd3f86ca68678b4f00951f78f52d0270.tar.gz |
Merge branch '8.0.x'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_options.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_options.py b/tests/test_options.py index 739da4e..7367a32 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"), [ |