When a boolean flag only has one opt and its default is False or None, it will not show the default
(runner, default)
| 1248 | |
| 1249 | @pytest.mark.parametrize("default", [False, None]) |
| 1250 | def 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 | |
| 1267 | def test_show_default_string(runner): |
nothing calls this directly
no test coverage detected
searching dependent graphs…