test_bashcomplete.py
This file
Path
tests/test_bashcomplete.py
409 lines · 14.9 KiB · Python
Last changed by
Merge pull request #1061 from stopthatcow/feature/1058David Lordbefore adoption752c5e4
History of this fileTake it
The walk stopped after 200 commits: lines older than 950463b point at it.
Fix typo (#817)scottbeldenbefore adoption950463b
lines 1–6why, one step back1# -*- coding: utf-8 -*-23import click4from click._bashcomplete import get_choices56Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 7–15why, one step back7def choices_without_help(cli, args, incomplete):8 completions = get_choices(cli, 'dummy', args, incomplete)9 return [c[0] for c in completions]101112def choices_with_help(cli, args, incomplete):13 return list(get_choices(cli, 'dummy', args, incomplete))1415Fix typo (#817)scottbeldenbefore adoption950463b
lines 16–21why, one step back16def test_single_command():17 @click.command()18 @click.option('--local-opt')19 def cli(local_opt):20 pass21Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 22–23why, one step back22 assert choices_without_help(cli, [], '-') == ['--local-opt']23 assert choices_without_help(cli, [], '') == []Fix typo (#817)scottbeldenbefore adoption950463b
lines 24–31why, one step back242526def test_boolean_flag():27 @click.command()28 @click.option('--shout/--no-shout', default=False)29 def cli(local_opt):30 pass31Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 32why, one step back32 assert choices_without_help(cli, [], '-') == ['--shout', '--no-shout']Fix typo (#817)scottbeldenbefore adoption950463b
lines 33–45why, one step back333435def test_multi_value_option():36 @click.group()37 @click.option('--pos', nargs=2, type=float)38 def cli(local_opt):39 pass4041 @cli.command()42 @click.option('--local-opt')43 def sub(local_opt):44 pass45Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 46–49why, one step back46 assert choices_without_help(cli, [], '-') == ['--pos']47 assert choices_without_help(cli, ['--pos'], '') == []48 assert choices_without_help(cli, ['--pos', '1.0'], '') == []49 assert choices_without_help(cli, ['--pos', '1.0', '1.0'], '') == ['sub']Fix typo (#817)scottbeldenbefore adoption950463b
lines 50–57why, one step back505152def test_multi_option():53 @click.command()54 @click.option('--message', '-m', multiple=True)55 def cli(local_opt):56 pass57Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 58–59why, one step back58 assert choices_without_help(cli, [], '-') == ['--message', '-m']59 assert choices_without_help(cli, ['-m'], '') == []Fix typo (#817)scottbeldenbefore adoption950463b
lines 60–72why, one step back606162def test_small_chain():63 @click.group()64 @click.option('--global-opt')65 def cli(global_opt):66 pass6768 @cli.command()69 @click.option('--local-opt')70 def sub(local_opt):71 pass72Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 73–76why, one step back73 assert choices_without_help(cli, [], '') == ['sub']74 assert choices_without_help(cli, [], '-') == ['--global-opt']75 assert choices_without_help(cli, ['sub'], '') == []76 assert choices_without_help(cli, ['sub'], '-') == ['--local-opt']Fix typo (#817)scottbeldenbefore adoption950463b
lines 77–97why, one step back777879def test_long_chain():80 @click.group('cli')81 @click.option('--cli-opt')82 def cli(cli_opt):83 pass8485 @cli.group('asub')86 @click.option('--asub-opt')87 def asub(asub_opt):88 pass8990 @asub.group('bsub')91 @click.option('--bsub-opt')92 def bsub(bsub_opt):93 pass9495 COLORS = ['red', 'green', 'blue']96 def get_colors(ctx, args, incomplete):97 for c in COLORS:Merge pull request #806 from stopthatcow/feature/790Markus Unterwaditzerbefore adoption5210849
lines 98–99why, one step back98 if c.startswith(incomplete):99 yield cFix typo (#817)scottbeldenbefore adoption950463b
line 100why, one step back100Merge pull request #806 from stopthatcow/feature/790Markus Unterwaditzerbefore adoption5210849
lines 101–105why, one step back101 def search_colors(ctx, args, incomplete):102 for c in COLORS:103 if incomplete in c:104 yield c105Fix typo (#817)scottbeldenbefore adoption950463b
lines 106–110why, one step back106 CSUB_OPT_CHOICES = ['foo', 'bar']107 CSUB_CHOICES = ['bar', 'baz']108 @bsub.command('csub')109 @click.option('--csub-opt', type=click.Choice(CSUB_OPT_CHOICES))110 @click.option('--csub', type=click.Choice(CSUB_CHOICES))Merge pull request #806 from stopthatcow/feature/790Markus Unterwaditzerbefore adoption5210849
line 111why, one step back111 @click.option('--search-color', autocompletion=search_colors)Fix typo (#817)scottbeldenbefore adoption950463b
lines 112–115why, one step back112 @click.argument('color', autocompletion=get_colors)113 def csub(csub_opt, color):114 pass115Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 116–129why, one step back116 assert choices_without_help(cli, [], '-') == ['--cli-opt']117 assert choices_without_help(cli, [], '') == ['asub']118 assert choices_without_help(cli, ['asub'], '-') == ['--asub-opt']119 assert choices_without_help(cli, ['asub'], '') == ['bsub']120 assert choices_without_help(cli, ['asub', 'bsub'], '-') == ['--bsub-opt']121 assert choices_without_help(cli, ['asub', 'bsub'], '') == ['csub']122 assert choices_without_help(cli, ['asub', 'bsub', 'csub'], '-') == ['--csub-opt', '--csub', '--search-color']123 assert choices_without_help(cli, ['asub', 'bsub', 'csub', '--csub-opt'], '') == CSUB_OPT_CHOICES124 assert choices_without_help(cli, ['asub', 'bsub', 'csub'], '--csub') == ['--csub-opt', '--csub']125 assert choices_without_help(cli, ['asub', 'bsub', 'csub', '--csub'], '') == CSUB_CHOICES126 assert choices_without_help(cli, ['asub', 'bsub', 'csub', '--csub-opt'], 'f') == ['foo']127 assert choices_without_help(cli, ['asub', 'bsub', 'csub'], '') == COLORS128 assert choices_without_help(cli, ['asub', 'bsub', 'csub'], 'b') == ['blue']129 assert choices_without_help(cli, ['asub', 'bsub', 'csub', '--search-color'], 'een') == ['green']Fix typo (#817)scottbeldenbefore adoption950463b
lines 130–134why, one step back130131132def test_chaining():133 @click.group('cli', chain=True)134 @click.option('--cli-opt')Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 135–136why, one step back135 @click.argument('arg', type=click.Choice(['cliarg1', 'cliarg2']))136 def cli(cli_opt, arg):Fix typo (#817)scottbeldenbefore adoption950463b
lines 137–138why, one step back137 pass138Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 139why, one step back139 @cli.command()Fix typo (#817)scottbeldenbefore adoption950463b
lines 140–143why, one step back140 @click.option('--asub-opt')141 def asub(asub_opt):142 pass143Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 144why, one step back144 @cli.command(help='bsub help')Fix typo (#817)scottbeldenbefore adoption950463b
line 145why, one step back145 @click.option('--bsub-opt')Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 146why, one step back146 @click.argument('arg', type=click.Choice(['arg1', 'arg2']))Fix typo (#817)scottbeldenbefore adoption950463b
lines 147–149why, one step back147 def bsub(bsub_opt, arg):148 pass149Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 150why, one step back150 @cli.command()Merge pull request #806 from stopthatcow/feature/790Markus Unterwaditzerbefore adoption5210849
line 151why, one step back151 @click.option('--csub-opt')Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 152why, one step back152 @click.argument('arg', type=click.Choice(['carg1', 'carg2']), default='carg1')Merge pull request #806 from stopthatcow/feature/790Markus Unterwaditzerbefore adoption5210849
lines 153–155why, one step back153 def csub(csub_opt, arg):154 pass155Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 156why, one step back156 assert choices_without_help(cli, [], '-') == ['--cli-opt']Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 157–167why, one step back157 assert choices_without_help(cli, [], '') == ['cliarg1', 'cliarg2']158 assert choices_without_help(cli, ['cliarg1', 'asub'], '-') == ['--asub-opt']159 assert choices_without_help(cli, ['cliarg1', 'asub'], '') == ['bsub', 'csub']160 assert choices_without_help(cli, ['cliarg1', 'bsub'], '') == ['arg1', 'arg2']161 assert choices_without_help(cli, ['cliarg1', 'asub', '--asub-opt'], '') == []162 assert choices_without_help(cli, ['cliarg1', 'asub', '--asub-opt', '5', 'bsub'], '-') == ['--bsub-opt']163 assert choices_without_help(cli, ['cliarg1', 'asub', 'bsub'], '-') == ['--bsub-opt']164 assert choices_without_help(cli, ['cliarg1', 'asub', 'csub'], '') == ['carg1', 'carg2']165 assert choices_without_help(cli, ['cliarg1', 'bsub', 'arg1', 'csub'], '') == ['carg1', 'carg2']166 assert choices_without_help(cli, ['cliarg1', 'asub', 'csub'], '-') == ['--csub-opt']167 assert choices_with_help(cli, ['cliarg1', 'asub'], 'b') == [('bsub', 'bsub help')]Fix typo (#817)scottbeldenbefore adoption950463b
lines 168–171why, one step back168169170def test_argument_choice():171 @click.command()Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 172–174why, one step back172 @click.argument('arg1', required=True, type=click.Choice(['arg11', 'arg12']))173 @click.argument('arg2', type=click.Choice(['arg21', 'arg22']), default='arg21')174 @click.argument('arg3', type=click.Choice(['arg', 'argument']), default='arg')Fix typo (#817)scottbeldenbefore adoption950463b
lines 175–177why, one step back175 def cli():176 pass177Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 178–182why, one step back178 assert choices_without_help(cli, [], '') == ['arg11', 'arg12']179 assert choices_without_help(cli, [], 'arg') == ['arg11', 'arg12']180 assert choices_without_help(cli, ['arg11'], '') == ['arg21', 'arg22']181 assert choices_without_help(cli, ['arg12', 'arg21'], '') == ['arg', 'argument']182 assert choices_without_help(cli, ['arg12', 'arg21'], 'argu') == ['argument']Fix typo (#817)scottbeldenbefore adoption950463b
lines 183–186why, one step back183184185def test_option_choice():186 @click.command()Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 187why, one step back187 @click.option('--opt1', type=click.Choice(['opt11', 'opt12']), help='opt1 help')Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 188why, one step back188 @click.option('--opt2', type=click.Choice(['opt21', 'opt22']), default='opt21')Fix typo (#817)scottbeldenbefore adoption950463b
lines 189–192why, one step back189 @click.option('--opt3', type=click.Choice(['opt', 'option']))190 def cli():191 pass192Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 193–207why, one step back193 assert choices_with_help(cli, [], '-') == [('--opt1', 'opt1 help'),194 ('--opt2', None),195 ('--opt3', None)]196 assert choices_without_help(cli, [], '--opt') == ['--opt1', '--opt2', '--opt3']197 assert choices_without_help(cli, [], '--opt1=') == ['opt11', 'opt12']198 assert choices_without_help(cli, [], '--opt2=') == ['opt21', 'opt22']199 assert choices_without_help(cli, ['--opt2'], '=') == ['opt21', 'opt22']200 assert choices_without_help(cli, ['--opt2', '='], 'opt') == ['opt21', 'opt22']201 assert choices_without_help(cli, ['--opt1'], '') == ['opt11', 'opt12']202 assert choices_without_help(cli, ['--opt2'], '') == ['opt21', 'opt22']203 assert choices_without_help(cli, ['--opt1', 'opt11', '--opt2'], '') == ['opt21', 'opt22']204 assert choices_without_help(cli, ['--opt2', 'opt21'], '-') == ['--opt1', '--opt3']205 assert choices_without_help(cli, ['--opt1', 'opt11'], '-') == ['--opt2', '--opt3']206 assert choices_without_help(cli, ['--opt1'], 'opt') == ['opt11', 'opt12']207 assert choices_without_help(cli, ['--opt3'], 'opti') == ['option']Fix typo (#817)scottbeldenbefore adoption950463b
line 208why, one step back208Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 209why, one step back209 assert choices_without_help(cli, ['--opt1', 'invalid_opt'], '-') == ['--opt2', '--opt3']Fix typo (#817)scottbeldenbefore adoption950463b
lines 210–219why, one step back210211212def test_option_and_arg_choice():213 @click.command()214 @click.option('--opt1', type=click.Choice(['opt11', 'opt12']))215 @click.argument('arg1', required=False, type=click.Choice(['arg11', 'arg12']))216 @click.option('--opt2', type=click.Choice(['opt21', 'opt22']))217 def cli():218 pass219Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 220–223why, one step back220 assert choices_without_help(cli, ['--opt1'], '') == ['opt11', 'opt12']221 assert choices_without_help(cli, [''], '--opt1=') == ['opt11', 'opt12']222 assert choices_without_help(cli, [], '') == ['arg11', 'arg12']223 assert choices_without_help(cli, ['--opt2'], '') == ['opt21', 'opt22']Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 224–225why, one step back224 assert choices_without_help(cli, ['arg11'], '--opt') == ['--opt1', '--opt2']225 assert choices_without_help(cli, [], '--opt') == ['--opt1', '--opt2']Fix typo (#817)scottbeldenbefore adoption950463b
lines 226–234why, one step back226227228def test_boolean_flag_choice():229 @click.command()230 @click.option('--shout/--no-shout', default=False)231 @click.argument('arg', required=False, type=click.Choice(['arg1', 'arg2']))232 def cli(local_opt):233 pass234Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 235–236why, one step back235 assert choices_without_help(cli, [], '-') == ['--shout', '--no-shout']236 assert choices_without_help(cli, ['--shout'], '') == ['arg1', 'arg2']Fix typo (#817)scottbeldenbefore adoption950463b
lines 237–245why, one step back237238239def test_multi_value_option_choice():240 @click.command()241 @click.option('--pos', nargs=2, type=click.Choice(['pos1', 'pos2']))242 @click.argument('arg', required=False, type=click.Choice(['arg1', 'arg2']))243 def cli(local_opt):244 pass245Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 246–249why, one step back246 assert choices_without_help(cli, ['--pos'], '') == ['pos1', 'pos2']247 assert choices_without_help(cli, ['--pos', 'pos1'], '') == ['pos1', 'pos2']248 assert choices_without_help(cli, ['--pos', 'pos1', 'pos2'], '') == ['arg1', 'arg2']249 assert choices_without_help(cli, ['--pos', 'pos1', 'pos2', 'arg1'], '') == []Fix typo (#817)scottbeldenbefore adoption950463b
lines 250–258why, one step back250251252def test_multi_option_choice():253 @click.command()254 @click.option('--message', '-m', multiple=True, type=click.Choice(['m1', 'm2']))255 @click.argument('arg', required=False, type=click.Choice(['arg1', 'arg2']))256 def cli(local_opt):257 pass258Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 259–261why, one step back259 assert choices_without_help(cli, ['-m'], '') == ['m1', 'm2']260 assert choices_without_help(cli, ['-m', 'm1', '-m'], '') == ['m1', 'm2']261 assert choices_without_help(cli, ['-m', 'm1'], '') == ['arg1', 'arg2']Fix typo (#817)scottbeldenbefore adoption950463b
lines 262–265why, one step back262263264def test_variadic_argument_choice():265 @click.command()Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 266why, one step back266 @click.option('--opt', type=click.Choice(['opt1', 'opt2']))Fix typo (#817)scottbeldenbefore adoption950463b
lines 267–270why, one step back267 @click.argument('src', nargs=-1, type=click.Choice(['src1', 'src2']))268 def cli(local_opt):269 pass270Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 271why, one step back271 assert choices_without_help(cli, ['src1', 'src2'], '') == ['src1', 'src2']Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 272–274why, one step back272 assert choices_without_help(cli, ['src1', 'src2'], '--o') == ['--opt']273 assert choices_without_help(cli, ['src1', 'src2', '--opt'], '') == ['opt1', 'opt2']274 assert choices_without_help(cli, ['src1', 'src2'], '') == ['src1', 'src2']Fix typo (#817)scottbeldenbefore adoption950463b
lines 275–276why, one step back275276Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 277–298why, one step back277def test_variadic_argument_complete():278279 def _complete(ctx, args, incomplete):280 return ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz']281282 @click.group()283 def entrypoint():284 pass285286 @click.command()287 @click.option('--opt', autocompletion=_complete)288 @click.argument('arg', nargs=-1)289 def subcommand(opt, arg):290 pass291292 entrypoint.add_command(subcommand)293294 assert choices_without_help(entrypoint, ['subcommand', '--opt'], '') == _complete(0,0,0)295 assert choices_without_help(entrypoint, ['subcommand', 'whatever', '--opt'], '') == _complete(0,0,0)296 assert choices_without_help(entrypoint, ['subcommand', 'whatever', '--opt', 'abc'], '') == []297298Fix typo (#817)scottbeldenbefore adoption950463b
lines 299–303why, one step back299def test_long_chain_choice():300 @click.group()301 def cli():302 pass303Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 304why, one step back304 @cli.group()Fix typo (#817)scottbeldenbefore adoption950463b
lines 305–306why, one step back305 @click.option('--sub-opt', type=click.Choice(['subopt1', 'subopt2']))306 @click.argument('sub-arg', required=False, type=click.Choice(['subarg1', 'subarg2']))Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 307why, one step back307 def sub(sub_opt, sub_arg):Fix typo (#817)scottbeldenbefore adoption950463b
lines 308–309why, one step back308 pass309Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 310why, one step back310 @sub.command(short_help='bsub help')Fix typo (#817)scottbeldenbefore adoption950463b
lines 311–316why, one step back311 @click.option('--bsub-opt', type=click.Choice(['bsubopt1', 'bsubopt2']))312 @click.argument('bsub-arg1', required=False, type=click.Choice(['bsubarg1', 'bsubarg2']))313 @click.argument('bbsub-arg2', required=False, type=click.Choice(['bbsubarg1', 'bbsubarg2']))314 def bsub(bsub_opt):315 pass316Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 317–326why, one step back317 @sub.group('csub')318 def csub():319 pass320321 @csub.command()322 def dsub():323 pass324325 assert choices_with_help(cli, ['sub', 'subarg1'], '') == [('bsub', 'bsub help'), ('csub', '')]326 assert choices_without_help(cli, ['sub'], '') == ['subarg1', 'subarg2']Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
lines 327–328why, one step back327 assert choices_without_help(cli, ['sub', '--sub-opt'], '') == ['subopt1', 'subopt2']328 assert choices_without_help(cli, ['sub', '--sub-opt', 'subopt1'], '') == \Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 329why, one step back329 ['subarg1', 'subarg2']Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 330why, one step back330 assert choices_without_help(cli,Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 331why, one step back331 ['sub', '--sub-opt', 'subopt1', 'subarg1', 'bsub'], '-') == ['--bsub-opt']Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 332why, one step back332 assert choices_without_help(cli,Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
line 333why, one step back333 ['sub', '--sub-opt', 'subopt1', 'subarg1', 'bsub'], '') == ['bsubarg1', 'bsubarg2']Merge pull request #869 from stopthatcow/feature/866David Lordbefore adoptiond37ff75
line 334why, one step back334 assert choices_without_help(cli,Merge pull request #930 from stopthatcow/feature/925David Lordbefore adoptionbe28b6c
lines 335–373why, one step back335 ['sub', '--sub-opt', 'subopt1', 'subarg1', 'bsub', '--bsub-opt'], '') == \336 ['bsubopt1', 'bsubopt2']337 assert choices_without_help(cli,338 ['sub', '--sub-opt', 'subopt1', 'subarg1', 'bsub', '--bsub-opt', 'bsubopt1', 'bsubarg1'],339 '') == ['bbsubarg1', 'bbsubarg2']340 assert choices_without_help(cli,341 ['sub', '--sub-opt', 'subopt1', 'subarg1', 'csub'],342 '') == ['dsub']343344345def test_chained_multi():346 @click.group()347 def cli():348 pass349350 @cli.group()351 def sub():352 pass353354 @sub.group()355 def bsub():356 pass357358 @sub.group(chain=True)359 def csub():360 pass361362 @csub.command()363 def dsub():364 pass365366 @csub.command()367 def esub():368 pass369370 assert choices_without_help(cli, ['sub'], '') == ['bsub', 'csub']371 assert choices_without_help(cli, ['sub'], 'c') == ['csub']372 assert choices_without_help(cli, ['sub', 'csub'], '') == ['dsub', 'esub']373 assert choices_without_help(cli, ['sub', 'csub', 'dsub'], '') == ['esub']Merge pull request #1061 from stopthatcow/feature/1058David Lordbefore adoption752c5e4
lines 374–409why, one step back374375376def test_hidden():377 @click.group()378 @click.option('--name', hidden=True)379 @click.option('--choices', type=click.Choice([1, 2]), hidden=True)380 def cli(name):381 pass382383 @cli.group(hidden=True)384 def hgroup():385 pass386387 @hgroup.group()388 def hgroupsub():389 pass390391 @cli.command()392 def asub():393 pass394395 @cli.command(hidden=True)396 @click.option('--hname')397 def hsub():398 pass399400 assert choices_without_help(cli, [], '--n') == []401 assert choices_without_help(cli, [], '--c') == []402 # If the user exactly types out the hidden param, complete its options.403 assert choices_without_help(cli, ['--choices'], '') == [1, 2]404 assert choices_without_help(cli, [], '') == ['asub']405 assert choices_without_help(cli, [], '') == ['asub']406 assert choices_without_help(cli, [], 'h') == []407 # If the user exactly types out the hidden command, complete its subcommands.408 assert choices_without_help(cli, ['hgroup'], '') == ['hgroupsub']409 assert choices_without_help(cli, ['hsub'], '--h') == ['--hname']