16
16
17
17
18
18
def test_basic_functionality_first_api (runner ):
19
-
20
19
@click .command ()
21
20
@click .option ("--hello" )
22
21
@optgroup ("Group 1" , help = "Group 1 description" )
@@ -45,7 +44,6 @@ def cli(hello, foo1, bar1, lol, foo2, bar2, goodbye):
45
44
46
45
47
46
def test_noname_group (runner ):
48
-
49
47
@click .command ()
50
48
@optgroup ()
51
49
@optgroup .option ("--foo" )
@@ -99,7 +97,6 @@ def cli3(**params):
99
97
100
98
101
99
def test_missing_group_decl_first_api (runner ):
102
-
103
100
@click .command ()
104
101
@click .option ("--hello1" )
105
102
@optgroup .option ("--foo" )
@@ -111,31 +108,31 @@ def cli(**params):
111
108
result = runner .invoke (cli , ["--help" ])
112
109
113
110
assert result .exception
114
- assert TypeError == result .exc_info [ 0 ]
111
+ assert isinstance ( result .exception , TypeError )
115
112
assert "Missing option group decorator" in str (result .exc_info [1 ])
116
113
assert "--foo" in str (result .exc_info [1 ])
117
114
assert "--bar" in str (result .exc_info [1 ])
118
115
119
116
result = runner .invoke (cli , [])
120
117
121
118
assert result .exception
122
- assert TypeError == result .exc_info [ 0 ]
119
+ assert isinstance ( result .exception , TypeError )
123
120
assert "Missing option group" in str (result .exc_info [1 ])
124
121
assert "--foo" in str (result .exc_info [1 ])
125
122
assert "--bar" in str (result .exc_info [1 ])
126
123
127
124
result = runner .invoke (cli , ["--hello1" , "hello1" ])
128
125
129
126
assert result .exception
130
- assert TypeError == result .exc_info [ 0 ]
127
+ assert isinstance ( result .exception , TypeError )
131
128
assert "Missing option group" in str (result .exc_info [1 ])
132
129
assert "--foo" in str (result .exc_info [1 ])
133
130
assert "--bar" in str (result .exc_info [1 ])
134
131
135
132
result = runner .invoke (cli , ["--foo" , "foo" ])
136
133
137
134
assert result .exception
138
- assert TypeError == result .exc_info [ 0 ]
135
+ assert isinstance ( result .exception , TypeError )
139
136
assert "Missing option group" in str (result .exc_info [1 ])
140
137
assert "--foo" in str (result .exc_info [1 ])
141
138
assert "--bar" in str (result .exc_info [1 ])
@@ -184,7 +181,6 @@ def cli(**params):
184
181
185
182
186
183
def test_incorrect_grouped_option_cls ():
187
-
188
184
@click .command ()
189
185
@optgroup ()
190
186
@optgroup .option ("--foo" , cls = GroupedOption )
@@ -472,7 +468,6 @@ def cli(foo):
472
468
473
469
474
470
def test_subcommand_first_api (runner ):
475
-
476
471
@click .group ()
477
472
@optgroup ("Group 1" , help = "Group 1 description" )
478
473
@optgroup .option ("--foo" )
@@ -677,7 +672,6 @@ def command2(**params):
677
672
678
673
679
674
def test_command_first_api (runner ):
680
-
681
675
@optgroup ("Group 1" )
682
676
@optgroup .option ("--foo" )
683
677
@optgroup .option ("--bar" )
@@ -697,7 +691,6 @@ def cli(foo, bar):
697
691
698
692
699
693
def test_hidden_option (runner ):
700
-
701
694
@click .command ()
702
695
@click .option ("--hello" )
703
696
@optgroup ("Group 1" , help = "Group 1 description" )
@@ -746,7 +739,9 @@ def cli(foo, bar):
746
739
def cli (foo , bar ):
747
740
click .echo (f"{ foo } ,{ bar } " )
748
741
749
- result = runner .invoke (cli , )
742
+ result = runner .invoke (
743
+ cli ,
744
+ )
750
745
assert isinstance (result .exception , TypeError )
751
746
assert "Need at least one non-hidden" in str (result .exception )
752
747
@@ -797,7 +792,6 @@ def cli(foo, bar):
797
792
],
798
793
)
799
794
def test_help_option (runner , param_decls , options , output ):
800
-
801
795
@click .command ()
802
796
@optgroup ("Help Options" )
803
797
@optgroup .help_option (* param_decls )
@@ -817,12 +811,10 @@ def cli() -> None:
817
811
818
812
819
813
def test_wrapped_functions (runner ):
820
-
821
814
def make_z ():
822
815
"""A unified option interface for making a `z`."""
823
816
824
817
def decorator (f ):
825
-
826
818
@optgroup .group ("Group xyz" )
827
819
@optgroup .option ("-x" , type = int )
828
820
@optgroup .option ("-y" , type = int )
@@ -839,7 +831,6 @@ def make_c():
839
831
"""A unified option interface for making a `c`."""
840
832
841
833
def decorator (f ):
842
-
843
834
@optgroup .group ("Group abc" )
844
835
@optgroup .option ("-a" , type = int )
845
836
@optgroup .option ("-b" , type = int )
0 commit comments