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

Function test_show_default_with_empty_string

tests/test_options.py:1309–1318  ·  view source on GitHub ↗

The empty-string check in help rendering must not break on objects whose ``__eq__`` raises for string operands. Regression test for https://github.com/pallets/click/issues/3298.

(runner, default, expected)

Source from the content-addressed store, hash-verified

1307 ids=["empty-string", "non-string-comparable-object"],
1308)
1309def test_show_default_with_empty_string(runner, default, expected):
1310 """The empty-string check in help rendering must not break on objects
1311 whose ``__eq__`` raises for string operands.
1312
1313 Regression test for https://github.com/pallets/click/issues/3298.
1314 """
1315 opt = click.Option(["--limit"], default=default, show_default=True)
1316 ctx = click.Context(click.Command("cli"))
1317 message = opt.get_help_record(ctx)[1]
1318 assert expected in message
1319
1320
1321def test_do_not_show_no_default(runner):

Callers

nothing calls this directly

Calls 1

get_help_recordMethod · 0.95

Tested by

no test coverage detected