MCPcopy
hub / github.com/pallets/click / test_hide_false_default_boolean_flag_value

Function test_hide_false_default_boolean_flag_value

tests/test_options.py:1250–1264  ·  view source on GitHub ↗

When a boolean flag only has one opt and its default is False or None, it will not show the default

(runner, default)

Source from the content-addressed store, hash-verified

1248
1249@pytest.mark.parametrize("default", [False, None])
1250def test_hide_false_default_boolean_flag_value(runner, default):
1251 """When a boolean flag only has one opt and its default is False or
1252 None, it will not show the default
1253 """
1254 opt = click.Option(
1255 ("--cache",),
1256 is_flag=True,
1257 show_default=True,
1258 default=default,
1259 help="Enable the cache.",
1260 )
1261 ctx = click.Context(click.Command("test"))
1262 assert opt.get_help_extra(ctx) == {}
1263 message = opt.get_help_record(ctx)[1]
1264 assert "[default: " not in message
1265
1266
1267def test_show_default_string(runner):

Callers

nothing calls this directly

Calls 2

get_help_extraMethod · 0.95
get_help_recordMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…