Skip to content
Myr

test_basic.py

This file

Path

tests/test_basic.py

560 lines · 15.5 KiB · Python

Last changed by

Merge branch '7.x'David Lordbefore adoption7239794

History of this file

Take it

The walk stopped after 200 commits: lines older than 2899795 point at it.

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 1–3why, one step back
1# -*- coding: utf-8 -*-
2import os3import uuid

Merge branch '7.x'David Lordbefore adoption7239794

line 4why, one step back
4

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 5–11why, one step back
5import click
678def test_basic_functionality(runner):9 @click.command()10 def cli():11 """Hello World!"""

Merge branch '7.x'David Lordbefore adoption7239794

line 12why, one step back
12 click.echo("I EXECUTED")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 13why, one step back
13

Merge branch '7.x'David Lordbefore adoption7239794

line 14why, one step back
14 result = runner.invoke(cli, ["--help"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 15why, one step back
15 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

lines 16–17why, one step back
16 assert "Hello World!" in result.output
17 assert "Show this message and exit." in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 18why, one step back
18 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

line 19why, one step back
19 assert "I EXECUTED" not in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 20–22why, one step back
20
21 result = runner.invoke(cli, [])22 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 23why, one step back
23 assert "I EXECUTED" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 24–26why, one step back
24 assert result.exit_code == 0
2526

Merge pull request #1295 from jzengg/issue-1267-add-name-to-command-reprDavid Lordbefore adoptione6eac0a

lines 27–39why, one step back
27def test_repr():
28 @click.command()29 def command():30 pass3132 @click.group()33 def group():34 pass3536 @group.command()37 def subcommand():38 pass39

Merge branch '7.x'David Lordbefore adoption7239794

lines 40–42why, one step back
40 assert repr(command) == "<Command command>"
41 assert repr(group) == "<Group group>"42 assert repr(subcommand) == "<Command subcommand>"

Merge pull request #1295 from jzengg/issue-1267-add-name-to-command-reprDavid Lordbefore adoptione6eac0a

lines 43–44why, one step back
43
44

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 45–49why, one step back
45def test_return_values():
46 @click.command()47 def cli():48 return 4249

Merge branch '7.x'David Lordbefore adoption7239794

line 50why, one step back
50 with cli.make_context("foo", []) as ctx:

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 51why, one step back
51 rv = cli.invoke(ctx)

Merge pull request #1445 from tirkarthi/fix-syntax-warningJoshua Bronsonbefore adoption6c454c8

line 52why, one step back
52 assert rv == 42

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 53–58why, one step back
53
5455def test_basic_group(runner):56 @click.group()57 def cli():58 """This is the root."""

Merge branch '7.x'David Lordbefore adoption7239794

line 59why, one step back
59 click.echo("ROOT EXECUTED")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 60–63why, one step back
60
61 @cli.command()62 def subcommand():63 """This is a subcommand."""

Merge branch '7.x'David Lordbefore adoption7239794

line 64why, one step back
64 click.echo("SUBCOMMAND EXECUTED")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 65why, one step back
65

Merge branch '7.x'David Lordbefore adoption7239794

line 66why, one step back
66 result = runner.invoke(cli, ["--help"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 67why, one step back
67 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

lines 68–70why, one step back
68 assert "COMMAND [ARGS]..." in result.output
69 assert "This is the root" in result.output70 assert "This is a subcommand." in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 71why, one step back
71 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

line 72why, one step back
72 assert "ROOT EXECUTED" not in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 73why, one step back
73

Merge branch '7.x'David Lordbefore adoption7239794

line 74why, one step back
74 result = runner.invoke(cli, ["subcommand"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 75–76why, one step back
75 assert not result.exception
76 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

lines 77–78why, one step back
77 assert "ROOT EXECUTED" in result.output
78 assert "SUBCOMMAND EXECUTED" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 79–82why, one step back
79
8081def test_basic_option(runner):82 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 83why, one step back
83 @click.option("--foo", default="no value")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 84why, one step back
84 def cli(foo):

Merge branch '7.x'David Lordbefore adoption7239794

line 85why, one step back
85 click.echo(u"FOO:[{}]".format(foo))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 86–88why, one step back
86
87 result = runner.invoke(cli, [])88 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 89why, one step back
89 assert "FOO:[no value]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 90why, one step back
90

Merge branch '7.x'David Lordbefore adoption7239794

line 91why, one step back
91 result = runner.invoke(cli, ["--foo=42"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 92why, one step back
92 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 93why, one step back
93 assert "FOO:[42]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 94why, one step back
94

Merge branch '7.x'David Lordbefore adoption7239794

line 95why, one step back
95 result = runner.invoke(cli, ["--foo"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 96why, one step back
96 assert result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 97why, one step back
97 assert "--foo option requires an argument" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 98why, one step back
98

Merge branch '7.x'David Lordbefore adoption7239794

line 99why, one step back
99 result = runner.invoke(cli, ["--foo="])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 100why, one step back
100 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 101why, one step back
101 assert "FOO:[]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 102why, one step back
102

Merge branch '7.x'David Lordbefore adoption7239794

line 103why, one step back
103 result = runner.invoke(cli, [u"--foo=\N{SNOWMAN}"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 104why, one step back
104 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 105why, one step back
105 assert u"FOO:[\N{SNOWMAN}]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 106–109why, one step back
106
107108def test_int_option(runner):109 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 110why, one step back
110 @click.option("--foo", default=42)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 111why, one step back
111 def cli(foo):

Merge branch '7.x'David Lordbefore adoption7239794

line 112why, one step back
112 click.echo("FOO:[{}]".format(foo * 2))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 113–115why, one step back
113
114 result = runner.invoke(cli, [])115 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 116why, one step back
116 assert "FOO:[84]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 117why, one step back
117

Merge branch '7.x'David Lordbefore adoption7239794

line 118why, one step back
118 result = runner.invoke(cli, ["--foo=23"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 119why, one step back
119 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 120why, one step back
120 assert "FOO:[46]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 121why, one step back
121

Merge branch '7.x'David Lordbefore adoption7239794

line 122why, one step back
122 result = runner.invoke(cli, ["--foo=bar"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 123why, one step back
123 assert result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 124why, one step back
124 assert "Invalid value for '--foo': bar is not a valid integer" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 125–128why, one step back
125
126127def test_uuid_option(runner):128 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 129–131why, one step back
129 @click.option(
130 "--u", default="ba122011-349f-423b-873b-9d6a79c688ab", type=click.UUID131 )

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 132–133why, one step back
132 def cli(u):
133 assert type(u) is uuid.UUID

Merge branch '7.x'David Lordbefore adoption7239794

line 134why, one step back
134 click.echo("U:[{}]".format(u))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 135–137why, one step back
135
136 result = runner.invoke(cli, [])137 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 138why, one step back
138 assert "U:[ba122011-349f-423b-873b-9d6a79c688ab]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 139why, one step back
139

Merge branch '7.x'David Lordbefore adoption7239794

line 140why, one step back
140 result = runner.invoke(cli, ["--u=821592c1-c50e-4971-9cd6-e89dc6832f86"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 141why, one step back
141 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 142why, one step back
142 assert "U:[821592c1-c50e-4971-9cd6-e89dc6832f86]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 143why, one step back
143

Merge branch '7.x'David Lordbefore adoption7239794

line 144why, one step back
144 result = runner.invoke(cli, ["--u=bar"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 145why, one step back
145 assert result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 146why, one step back
146 assert "Invalid value for '--u': bar is not a valid UUID value" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 147–150why, one step back
147
148149def test_float_option(runner):150 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 151why, one step back
151 @click.option("--foo", default=42, type=click.FLOAT)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 152–153why, one step back
152 def cli(foo):
153 assert type(foo) is float

Merge branch '7.x'David Lordbefore adoption7239794

line 154why, one step back
154 click.echo("FOO:[{}]".format(foo))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 155–157why, one step back
155
156 result = runner.invoke(cli, [])157 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 158why, one step back
158 assert "FOO:[42.0]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 159why, one step back
159

Merge branch '7.x'David Lordbefore adoption7239794

line 160why, one step back
160 result = runner.invoke(cli, ["--foo=23.5"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 161why, one step back
161 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 162why, one step back
162 assert "FOO:[23.5]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 163why, one step back
163

Merge branch '7.x'David Lordbefore adoption7239794

line 164why, one step back
164 result = runner.invoke(cli, ["--foo=bar"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 165why, one step back
165 assert result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 166why, one step back
166 assert "Invalid value for '--foo': bar is not a valid float" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 167–170why, one step back
167
168169def test_boolean_option(runner):170 for default in True, False:

Merge branch '7.x'David Lordbefore adoption7239794

line 171why, one step back
171

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 172why, one step back
172 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 173why, one step back
173 @click.option("--with-foo/--without-foo", default=default)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 174–176why, one step back
174 def cli(with_foo):
175 click.echo(with_foo)176

Merge branch '7.x'David Lordbefore adoption7239794

line 177why, one step back
177 result = runner.invoke(cli, ["--with-foo"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 178why, one step back
178 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

lines 179–180why, one step back
179 assert result.output == "True\n"
180 result = runner.invoke(cli, ["--without-foo"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 181why, one step back
181 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 182why, one step back
182 assert result.output == "False\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 183–184why, one step back
183 result = runner.invoke(cli, [])
184 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 185why, one step back
185 assert result.output == "{}\n".format(default)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 186–187why, one step back
186
187 for default in True, False:

Merge branch '7.x'David Lordbefore adoption7239794

line 188why, one step back
188

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 189why, one step back
189 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 190why, one step back
190 @click.option("--flag", is_flag=True, default=default)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 191–193why, one step back
191 def cli(flag):
192 click.echo(flag)193

Merge branch '7.x'David Lordbefore adoption7239794

line 194why, one step back
194 result = runner.invoke(cli, ["--flag"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 195why, one step back
195 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 196why, one step back
196 assert result.output == "{}\n".format(not default)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 197–198why, one step back
197 result = runner.invoke(cli, [])
198 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 199why, one step back
199 assert result.output == "{}\n".format(default)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 200–201why, one step back
200
201

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

lines 202–203why, one step back
202def test_boolean_conversion(runner):
203 for default in True, False:

Merge branch '7.x'David Lordbefore adoption7239794

line 204why, one step back
204

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

line 205why, one step back
205 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 206why, one step back
206 @click.option("--flag", default=default, type=bool)

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

lines 207–209why, one step back
207 def cli(flag):
208 click.echo(flag)209

Merge branch '7.x'David Lordbefore adoption7239794

lines 210–211why, one step back
210 for value in "true", "t", "1", "yes", "y":
211 result = runner.invoke(cli, ["--flag", value])

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

line 212why, one step back
212 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 213why, one step back
213 assert result.output == "True\n"

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

line 214why, one step back
214

Merge branch '7.x'David Lordbefore adoption7239794

lines 215–216why, one step back
215 for value in "false", "f", "0", "no", "n":
216 result = runner.invoke(cli, ["--flag", value])

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

line 217why, one step back
217 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 218why, one step back
218 assert result.output == "False\n"

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

lines 219–221why, one step back
219
220 result = runner.invoke(cli, [])221 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 222why, one step back
222 assert result.output == "{}\n".format(default)

Merge pull request #842 from axu2/masterMarkus Unterwaditzerbefore adoption752ff79

lines 223–224why, one step back
223
224

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 225–226why, one step back
225def test_file_option(runner):
226 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 227why, one step back
227 @click.option("--file", type=click.File("w"))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 228why, one step back
228 def input(file):

Merge branch '7.x'David Lordbefore adoption7239794

line 229why, one step back
229 file.write("Hello World!\n")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 230–231why, one step back
230
231 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 232why, one step back
232 @click.option("--file", type=click.File("r"))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 233–236why, one step back
233 def output(file):
234 click.echo(file.read())235236 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

lines 237–238why, one step back
237 result_in = runner.invoke(input, ["--file=example.txt"])
238 result_out = runner.invoke(output, ["--file=example.txt"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 239–240why, one step back
239
240 assert not result_in.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 241why, one step back
241 assert result_in.output == ""

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 242why, one step back
242 assert not result_out.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 243why, one step back
243 assert result_out.output == "Hello World!\n\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 244–249why, one step back
244
245246def test_file_lazy_mode(runner):247 do_io = False248249 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 250why, one step back
250 @click.option("--file", type=click.File("w"))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 251–252why, one step back
251 def input(file):
252 if do_io:

Merge branch '7.x'David Lordbefore adoption7239794

line 253why, one step back
253 file.write("Hello World!\n")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 254–255why, one step back
254
255 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 256why, one step back
256 @click.option("--file", type=click.File("r"))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 257–260why, one step back
257 def output(file):
258 pass259260 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

line 261why, one step back
261 os.mkdir("example.txt")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 262–263why, one step back
262
263 do_io = True

Merge branch '7.x'David Lordbefore adoption7239794

line 264why, one step back
264 result_in = runner.invoke(input, ["--file=example.txt"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 265–267why, one step back
265 assert result_in.exit_code == 1
266267 do_io = False

Merge branch '7.x'David Lordbefore adoption7239794

line 268why, one step back
268 result_in = runner.invoke(input, ["--file=example.txt"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 269–270why, one step back
269 assert result_in.exit_code == 0
270

Merge branch '7.x'David Lordbefore adoption7239794

line 271why, one step back
271 result_out = runner.invoke(output, ["--file=example.txt"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 272–274why, one step back
272 assert result_out.exception
273274 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 275why, one step back
275 @click.option("--file", type=click.File("w", lazy=False))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 276why, one step back
276 def input_non_lazy(file):

Merge branch '7.x'David Lordbefore adoption7239794

line 277why, one step back
277 file.write("Hello World!\n")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 278–279why, one step back
278
279 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

lines 280–281why, one step back
280 os.mkdir("example.txt")
281 result_in = runner.invoke(input_non_lazy, ["--file=example.txt"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 282why, one step back
282 assert result_in.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

lines 283–284why, one step back
283 assert (
284 "Invalid value for '--file': Could not open file: example.txt"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 285why, one step back
285 in result_in.output

Merge branch '7.x'David Lordbefore adoption7239794

line 286why, one step back
286 )

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 287–290why, one step back
287
288289def test_path_option(runner):290 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 291why, one step back
291 @click.option("-O", type=click.Path(file_okay=False, exists=True, writable=True))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 292why, one step back
292 def write_to_dir(o):

Merge branch '7.x'David Lordbefore adoption7239794

lines 293–294why, one step back
293 with open(os.path.join(o, "foo.txt"), "wb") as f:
294 f.write(b"meh\n")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 295–296why, one step back
295
296 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

line 297why, one step back
297 os.mkdir("test")

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 298why, one step back
298

Merge branch '7.x'David Lordbefore adoption7239794

line 299why, one step back
299 result = runner.invoke(write_to_dir, ["-O", "test"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 300–301why, one step back
300 assert not result.exception
301

Merge branch '7.x'David Lordbefore adoption7239794

lines 302–303why, one step back
302 with open("test/foo.txt", "rb") as f:
303 assert f.read() == b"meh\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 304why, one step back
304

Merge branch '7.x'David Lordbefore adoption7239794

lines 305–306why, one step back
305 result = runner.invoke(write_to_dir, ["-O", "test/foo.txt"])
306 assert "is a file" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 307–308why, one step back
307
308 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 309why, one step back
309 @click.option("-f", type=click.Path(exists=True))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 310why, one step back
310 def showtype(f):

Merge branch '7.x'David Lordbefore adoption7239794

lines 311–312why, one step back
311 click.echo("is_file={}".format(os.path.isfile(f)))
312 click.echo("is_dir={}".format(os.path.isdir(f)))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 313–314why, one step back
313
314 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

lines 315–316why, one step back
315 result = runner.invoke(showtype, ["-f", "xxx"])
316 assert "does not exist" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 317why, one step back
317

Merge branch '7.x'David Lordbefore adoption7239794

lines 318–320why, one step back
318 result = runner.invoke(showtype, ["-f", "."])
319 assert "is_file=False" in result.output320 assert "is_dir=True" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 321–322why, one step back
321
322 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 323why, one step back
323 @click.option("-f", type=click.Path())

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 324why, one step back
324 def exists(f):

Merge branch '7.x'David Lordbefore adoption7239794

line 325why, one step back
325 click.echo("exists={}".format(os.path.exists(f)))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 326–327why, one step back
326
327 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

lines 328–329why, one step back
328 result = runner.invoke(exists, ["-f", "xxx"])
329 assert "exists=False" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 330why, one step back
330

Merge branch '7.x'David Lordbefore adoption7239794

lines 331–332why, one step back
331 result = runner.invoke(exists, ["-f", "."])
332 assert "exists=True" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 333–336why, one step back
333
334335def test_choice_option(runner):336 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 337why, one step back
337 @click.option("--method", type=click.Choice(["foo", "bar", "baz"]))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 338–340why, one step back
338 def cli(method):
339 click.echo(method)340

Merge branch '7.x'David Lordbefore adoption7239794

line 341why, one step back
341 result = runner.invoke(cli, ["--method=foo"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 342why, one step back
342 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 343why, one step back
343 assert result.output == "foo\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 344why, one step back
344

Merge branch '7.x'David Lordbefore adoption7239794

line 345why, one step back
345 result = runner.invoke(cli, ["--method=meh"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 346why, one step back
346 assert result.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

lines 347–350why, one step back
347 assert (
348 "Invalid value for '--method': invalid choice: meh."349 " (choose from foo, bar, baz)" in result.output350 )

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 351why, one step back
351

Merge branch '7.x'David Lordbefore adoption7239794

lines 352–353why, one step back
352 result = runner.invoke(cli, ["--help"])
353 assert "--method [foo|bar|baz]" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 354–355why, one step back
354
355

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

lines 356–357why, one step back
356def test_datetime_option_default(runner):
357 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 358why, one step back
358 @click.option("--start_date", type=click.DateTime())

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 359why, one step back
359 def cli(start_date):

Merge branch '7.x'David Lordbefore adoption7239794

line 360why, one step back
360 click.echo(start_date.strftime("%Y-%m-%dT%H:%M:%S"))

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 361why, one step back
361

Merge branch '7.x'David Lordbefore adoption7239794

line 362why, one step back
362 result = runner.invoke(cli, ["--start_date=2015-09-29"])

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 363why, one step back
363 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 364why, one step back
364 assert result.output == "2015-09-29T00:00:00\n"

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 365why, one step back
365

Merge branch '7.x'David Lordbefore adoption7239794

line 366why, one step back
366 result = runner.invoke(cli, ["--start_date=2015-09-29T09:11:22"])

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 367why, one step back
367 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 368why, one step back
368 assert result.output == "2015-09-29T09:11:22\n"

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 369why, one step back
369

Merge branch '7.x'David Lordbefore adoption7239794

line 370why, one step back
370 result = runner.invoke(cli, ["--start_date=2015-09"])

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 371why, one step back
371 assert result.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

lines 372–376why, one step back
372 assert (
373 "Invalid value for '--start_date':"374 " invalid datetime format: 2015-09."375 " (choose from %Y-%m-%d, %Y-%m-%dT%H:%M:%S, %Y-%m-%d %H:%M:%S)"376 ) in result.output

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 377why, one step back
377

Merge branch '7.x'David Lordbefore adoption7239794

lines 378–381why, one step back
378 result = runner.invoke(cli, ["--help"])
379 assert (380 "--start_date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]" in result.output381 )

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

lines 382–385why, one step back
382
383384def test_datetime_option_custom(runner):385 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 386why, one step back
386 @click.option("--start_date", type=click.DateTime(formats=["%A %B %d, %Y"]))

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 387why, one step back
387 def cli(start_date):

Merge branch '7.x'David Lordbefore adoption7239794

line 388why, one step back
388 click.echo(start_date.strftime("%Y-%m-%dT%H:%M:%S"))

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 389why, one step back
389

Merge branch '7.x'David Lordbefore adoption7239794

line 390why, one step back
390 result = runner.invoke(cli, ["--start_date=Wednesday June 05, 2010"])

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

line 391why, one step back
391 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 392why, one step back
392 assert result.output == "2010-06-05T00:00:00\n"

Merge pull request #1099 from sirosen/type-datetimeDavid Lordbefore adoption2c622ee

lines 393–394why, one step back
393
394

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 395–396why, one step back
395def test_int_range_option(runner):
396 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 397why, one step back
397 @click.option("--x", type=click.IntRange(0, 5))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 398–400why, one step back
398 def cli(x):
399 click.echo(x)400

Merge branch '7.x'David Lordbefore adoption7239794

line 401why, one step back
401 result = runner.invoke(cli, ["--x=5"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 402why, one step back
402 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 403why, one step back
403 assert result.output == "5\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 404why, one step back
404

Merge branch '7.x'David Lordbefore adoption7239794

line 405why, one step back
405 result = runner.invoke(cli, ["--x=6"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 406why, one step back
406 assert result.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

lines 407–408why, one step back
407 assert (
408 "Invalid value for '--x': 6 is not in the valid range of 0 to 5.\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 409why, one step back
409 in result.output

Merge branch '7.x'David Lordbefore adoption7239794

line 410why, one step back
410 )

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 411–412why, one step back
411
412 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 413why, one step back
413 @click.option("--x", type=click.IntRange(0, 5, clamp=True))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 414–416why, one step back
414 def clamp(x):
415 click.echo(x)416

Merge branch '7.x'David Lordbefore adoption7239794

line 417why, one step back
417 result = runner.invoke(clamp, ["--x=5"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 418why, one step back
418 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 419why, one step back
419 assert result.output == "5\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 420why, one step back
420

Merge branch '7.x'David Lordbefore adoption7239794

line 421why, one step back
421 result = runner.invoke(clamp, ["--x=6"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 422why, one step back
422 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 423why, one step back
423 assert result.output == "5\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 424why, one step back
424

Merge branch '7.x'David Lordbefore adoption7239794

line 425why, one step back
425 result = runner.invoke(clamp, ["--x=-1"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 426why, one step back
426 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 427why, one step back
427 assert result.output == "0\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 428–431why, one step back
428
429430def test_float_range_option(runner):431 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 432why, one step back
432 @click.option("--x", type=click.FloatRange(0, 5))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 433–435why, one step back
433 def cli(x):
434 click.echo(x)435

Merge branch '7.x'David Lordbefore adoption7239794

line 436why, one step back
436 result = runner.invoke(cli, ["--x=5.0"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 437why, one step back
437 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 438why, one step back
438 assert result.output == "5.0\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 439why, one step back
439

Merge branch '7.x'David Lordbefore adoption7239794

line 440why, one step back
440 result = runner.invoke(cli, ["--x=6.0"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 441why, one step back
441 assert result.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

lines 442–443why, one step back
442 assert (
443 "Invalid value for '--x': 6.0 is not in the valid range of 0 to 5.\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 444why, one step back
444 in result.output

Merge branch '7.x'David Lordbefore adoption7239794

line 445why, one step back
445 )

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 446–447why, one step back
446
447 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 448why, one step back
448 @click.option("--x", type=click.FloatRange(0, 5, clamp=True))

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 449–451why, one step back
449 def clamp(x):
450 click.echo(x)451

Merge branch '7.x'David Lordbefore adoption7239794

line 452why, one step back
452 result = runner.invoke(clamp, ["--x=5.0"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 453why, one step back
453 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 454why, one step back
454 assert result.output == "5.0\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 455why, one step back
455

Merge branch '7.x'David Lordbefore adoption7239794

line 456why, one step back
456 result = runner.invoke(clamp, ["--x=6.0"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 457why, one step back
457 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 458why, one step back
458 assert result.output == "5\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 459why, one step back
459

Merge branch '7.x'David Lordbefore adoption7239794

line 460why, one step back
460 result = runner.invoke(clamp, ["--x=-1.0"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 461why, one step back
461 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 462why, one step back
462 assert result.output == "0\n"

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 463–466why, one step back
463
464465def test_required_option(runner):466 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 467why, one step back
467 @click.option("--foo", required=True)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 468–472why, one step back
468 def cli(foo):
469 click.echo(foo)470471 result = runner.invoke(cli, [])472 assert result.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

line 473why, one step back
473 assert "Missing option '--foo'" in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 474–478why, one step back
474
475476def test_evaluation_order(runner):477 called = []478

Merge branch '6.x-maintenance'Armin Ronacherbefore adoption7404b06

line 479why, one step back
479 def memo(ctx, param, value):

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 480–483why, one step back
480 called.append(value)
481 return value482483 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 484–490why, one step back
484 @click.option("--missing", default="missing", is_eager=False, callback=memo)
485 @click.option("--eager-flag1", flag_value="eager1", is_eager=True, callback=memo)486 @click.option("--eager-flag2", flag_value="eager2", is_eager=True, callback=memo)487 @click.option("--eager-flag3", flag_value="eager3", is_eager=True, callback=memo)488 @click.option("--normal-flag1", flag_value="normal1", is_eager=False, callback=memo)489 @click.option("--normal-flag2", flag_value="normal2", is_eager=False, callback=memo)490 @click.option("--normal-flag3", flag_value="normal3", is_eager=False, callback=memo)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 491–493why, one step back
491 def cli(**x):
492 pass493

Merge branch '7.x'David Lordbefore adoption7239794

lines 494–506why, one step back
494 result = runner.invoke(
495 cli,496 [497 "--eager-flag2",498 "--eager-flag1",499 "--normal-flag2",500 "--eager-flag3",501 "--normal-flag3",502 "--normal-flag3",503 "--normal-flag1",504 "--normal-flag1",505 ],506 )

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 507–508why, one step back
507 assert not result.exception
508 assert called == [

Merge branch '7.x'David Lordbefore adoption7239794

lines 509–515why, one step back
509 "eager2",
510 "eager1",511 "eager3",512 "normal2",513 "normal3",514 "normal1",515 "missing",

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 516–520why, one step back
516 ]
517518519def test_hidden_option(runner):520 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 521why, one step back
521 @click.option("--nope", hidden=True)

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 522–524why, one step back
522 def cli(nope):
523 click.echo(nope)524

Merge branch '7.x'David Lordbefore adoption7239794

line 525why, one step back
525 result = runner.invoke(cli, ["--help"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 526why, one step back
526 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

line 527why, one step back
527 assert "--nope" not in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 528–538why, one step back
528
529530def test_hidden_command(runner):531 @click.group()532 def cli():533 pass534535 @cli.command(hidden=True)536 def nope():537 pass538

Merge branch '7.x'David Lordbefore adoption7239794

line 539why, one step back
539 result = runner.invoke(cli, ["--help"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 540why, one step back
540 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

line 541why, one step back
541 assert "nope" not in result.output

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 542–556why, one step back
542
543544def test_hidden_group(runner):545 @click.group()546 def cli():547 pass548549 @cli.group(hidden=True)550 def subgroup():551 pass552553 @subgroup.command()554 def nope():555 pass556

Merge branch '7.x'David Lordbefore adoption7239794

line 557why, one step back
557 result = runner.invoke(cli, ["--help"])

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

line 558why, one step back
558 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

lines 559–560why, one step back
559 assert "subgroup" not in result.output
560 assert "nope" not in result.output