File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ def _write_opts(opts):
88
88
)
89
89
90
90
if isinstance (opt .type , click .Choice ):
91
- extras .append (':options: %s' % ' | ' .join (opt .type .choices ))
91
+ extras .append (':options: %s' % ' | ' .join (str ( x ) for x in opt .type .choices ))
92
92
93
93
if extras :
94
94
if out :
Original file line number Diff line number Diff line change 8
8
class CommandTestCase (unittest .TestCase ):
9
9
"""Validate basic ``click.Command`` instances."""
10
10
11
+ maxDiff = None
12
+
11
13
def test_no_parameters (self ):
12
14
"""Validate a `click.Command` with no parameters.
13
15
@@ -52,6 +54,12 @@ def test_basic_parameters(self):
52
54
help = 'A sample option with choices' ,
53
55
type = click .Choice (['Option1' , 'Option2' ]),
54
56
)
57
+ @click .option (
58
+ '--numeric-choice' ,
59
+ metavar = '<choice>' ,
60
+ help = 'A sample option with numeric choices' ,
61
+ type = click .Choice ([1 , 2 , 3 ]),
62
+ )
55
63
@click .argument ('ARG' , envvar = 'ARG' )
56
64
def foobar (bar ):
57
65
"""A sample command."""
@@ -86,6 +94,12 @@ def foobar(bar):
86
94
87
95
:options: Option1 | Option2
88
96
97
+ .. option:: --numeric-choice <choice>
98
+
99
+ A sample option with numeric choices
100
+
101
+ :options: 1 | 2 | 3
102
+
89
103
.. rubric:: Arguments
90
104
91
105
.. option:: ARG
You can’t perform that action at this time.
0 commit comments