@@ -72,6 +72,30 @@ def test_deprecated_empty_help_no_leading_space(help_text, deprecated, expected)
7272 assert opt .get_help_record (ctx )[1 ] == expected
7373
7474
75+ @pytest .mark .parametrize (
76+ ("param_decls" , "kwargs" , "expected" ),
77+ [
78+ (["-v" , "--verbose" ], {"is_flag" : True }, "-v, --verbose" ),
79+ (["--config" ], {}, "--config TEXT" ),
80+ (["--color/--no-color" ], {}, "--color / --no-color" ),
81+ (["/debug;/no-debug" ], {}, "/debug; /no-debug" ),
82+ ],
83+ )
84+ @pytest .mark .parametrize ("hidden" , [False , True ])
85+ def test_help_spec (param_decls , kwargs , hidden , expected ):
86+ """A hidden option still produces its spec via ``get_help_spec()``, unlike
87+ ``get_help_record()``.
88+ """
89+ opt = click .Option (param_decls , hidden = hidden , ** kwargs )
90+ ctx = click .Context (click .Command ("cli" ))
91+ assert opt .get_help_spec (ctx ) == expected
92+
93+ if hidden :
94+ assert opt .get_help_record (ctx ) is None
95+ else :
96+ assert opt .get_help_record (ctx )[0 ] == expected
97+
98+
7599@pytest .mark .parametrize ("deprecated" , [True , "USE B INSTEAD" ])
76100def test_deprecated_warning (runner , deprecated ):
77101 @click .command ()
0 commit comments