Skip to content
Myr

test_arguments.py

This file

Path

tests/test_arguments.py

305 lines · 8.2 KiB · Python

Last changed by

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

History of this file

Take it

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

Merge branch '7.x'David Lordbefore adoption7239794

lines 1–2why, one step back
1import sys
2

Merge pull request #1014 from rhgrant10/feature/574David Lordbefore adoptionb0c7523

line 3why, one step back
3import pytest

Merge branch '7.x'David Lordbefore adoption7239794

line 4why, one step back
4

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 5–9why, one step back
5import click
678def test_nargs_star(runner):9 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 10–11why, one step back
10 @click.argument("src", nargs=-1)
11 @click.argument("dst")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 12why, one step back
12 def copy(src, dst):

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

lines 13–14why, one step back
13 click.echo(f"src={'|'.join(src)}")
14 click.echo(f"dst={dst}")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 15why, one step back
15

Merge branch '7.x'David Lordbefore adoption7239794

line 16why, one step back
16 result = runner.invoke(copy, ["foo.txt", "bar.txt", "dir"])

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 18why, one step back
18 assert result.output.splitlines() == ["src=foo.txt|bar.txt", "dst=dir"]

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 19–21why, one step back
19
2021def test_nargs_default(runner):

Merge branch '7.x'David Lordbefore adoption7239794

lines 22–23why, one step back
22 with pytest.raises(TypeError, match="nargs=-1"):
23

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 25why, one step back
25 @click.argument("src", nargs=-1, default=42)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 26–31why, one step back
26 def copy(src):
27 pass282930def test_nargs_tup(runner):31 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 32–33why, one step back
32 @click.argument("name", nargs=1)
33 @click.argument("point", nargs=2, type=click.INT)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 34why, one step back
34 def copy(name, point):

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

lines 35–37why, one step back
35 click.echo(f"name={name}")
36 x, y = point37 click.echo(f"point={x}/{y}")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 38why, one step back
38

Merge branch '7.x'David Lordbefore adoption7239794

line 39why, one step back
39 result = runner.invoke(copy, ["peter", "1", "2"])

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 41why, one step back
41 assert result.output.splitlines() == ["name=peter", "point=1/2"]

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 42–52why, one step back
42
4344def test_nargs_tup_composite(runner):45 variations = [46 dict(type=(str, int)),47 dict(type=click.Tuple([str, int])),48 dict(nargs=2, type=click.Tuple([str, int])),49 dict(nargs=2, type=(str, int)),50 ]5152 for opts in variations:

Merge branch '7.x'David Lordbefore adoption7239794

line 53why, one step back
53

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 55why, one step back
55 @click.argument("item", **opts)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 56why, one step back
56 def copy(item):

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

lines 57–58why, one step back
57 name, id = item
58 click.echo(f"name={name} id={id:d}")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 59why, one step back
59

Merge branch '7.x'David Lordbefore adoption7239794

line 60why, one step back
60 result = runner.invoke(copy, ["peter", "1"])

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 62why, one step back
62 assert result.output.splitlines() == ["name=peter id=1"]

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 63–66why, one step back
63
6465def test_nargs_err(runner):66 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 67why, one step back
67 @click.argument("x")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 68–70why, one step back
68 def copy(x):
69 click.echo(x)70

Merge branch '7.x'David Lordbefore adoption7239794

line 71why, one step back
71 result = runner.invoke(copy, ["foo"])

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

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

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 74why, one step back
74

Merge branch '7.x'David Lordbefore adoption7239794

line 75why, one step back
75 result = runner.invoke(copy, ["foo", "bar"])

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 77why, one step back
77 assert "Got unexpected extra argument (bar)" in result.output

Merge branch '7.x'David Lordbefore adoption8f36eab

lines 78–81why, one step back
78
7980def test_bytes_args(runner, monkeypatch):81 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 82why, one step back
82 @click.argument("arg")

Merge branch '7.x'David Lordbefore adoption8f36eab

line 83why, one step back
83 def from_bytes(arg):

Merge branch '7.x'David Lordbefore adoption7239794

line 84why, one step back
84 assert isinstance(

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

line 85why, one step back
85 arg, str

Merge branch '7.x'David Lordbefore adoption7239794

line 86why, one step back
86 ), "UTF-8 encoded argument should be implicitly converted to Unicode"

Merge branch '7.x'David Lordbefore adoption8f36eab

lines 87–88why, one step back
87
88 # Simulate empty locale environment variables

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

lines 89–91why, one step back
89 monkeypatch.setattr(sys.stdin, "encoding", "utf-8")
90 monkeypatch.setattr(sys, "getfilesystemencoding", lambda: "utf-8")91 monkeypatch.setattr(sys, "getdefaultencoding", lambda: "utf-8")

Merge branch '7.x'David Lordbefore adoption8f36eab

line 92why, one step back
92

Merge branch '7.x'David Lordbefore adoption7239794

lines 93–94why, one step back
93 runner.invoke(
94 from_bytes,

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

line 95why, one step back
95 ["Something outside of ASCII range: 林".encode()],

Merge branch '7.x'David Lordbefore adoption7239794

lines 96–97why, one step back
96 catch_exceptions=False,
97 )

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 98–101why, one step back
98
99100def test_file_args(runner):101 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 102–103why, one step back
102 @click.argument("input", type=click.File("rb"))
103 @click.argument("output", type=click.File("wb"))

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 104–111why, one step back
104 def inout(input, output):
105 while True:106 chunk = input.read(1024)107 if not chunk:108 break109 output.write(chunk)110111 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

lines 112–113why, one step back
112 result = runner.invoke(inout, ["-", "hello.txt"], input="Hey!")
113 assert result.output == ""

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

lines 115–116why, one step back
115 with open("hello.txt", "rb") as f:
116 assert f.read() == b"Hey!"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 117why, one step back
117

Merge branch '7.x'David Lordbefore adoption7239794

lines 118–119why, one step back
118 result = runner.invoke(inout, ["hello.txt", "-"])
119 assert result.output == "Hey!"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 120–124why, one step back
120 assert result.exit_code == 0
121122123def test_path_args(runner):124 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 125why, one step back
125 @click.argument("input", type=click.Path(dir_okay=False, allow_dash=True))

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 126–128why, one step back
126 def foo(input):
127 click.echo(input)128

Merge branch '7.x'David Lordbefore adoption7239794

lines 129–130why, one step back
129 result = runner.invoke(foo, ["-"])
130 assert result.output == "-\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 131–135why, one step back
131 assert result.exit_code == 0
132133134def test_file_atomics(runner):135 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 136why, one step back
136 @click.argument("output", type=click.File("wb", atomic=True))

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 137why, one step back
137 def inout(output):

Merge branch '7.x'David Lordbefore adoption7239794

line 138why, one step back
138 output.write(b"Foo bar baz\n")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 139why, one step back
139 output.flush()

Merge branch '7.x'David Lordbefore adoption7239794

line 140why, one step back
140 with open(output.name, "rb") as f:

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 141why, one step back
141 old_content = f.read()

Merge branch '7.x'David Lordbefore adoption7239794

line 142why, one step back
142 assert old_content == b"OLD\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 143–144why, one step back
143
144 with runner.isolated_filesystem():

Merge branch '7.x'David Lordbefore adoption7239794

lines 145–148why, one step back
145 with open("foo.txt", "wb") as f:
146 f.write(b"OLD\n")147 result = runner.invoke(inout, ["foo.txt"], input="Hey!", catch_exceptions=False)148 assert result.output == ""

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

lines 150–151why, one step back
150 with open("foo.txt", "rb") as f:
151 assert f.read() == b"Foo bar baz\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 152–155why, one step back
152
153154def test_stdout_default(runner):155 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 156why, one step back
156 @click.argument("output", type=click.File("w"), default="-")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 157why, one step back
157 def inout(output):

Merge branch '7.x'David Lordbefore adoption7239794

line 158why, one step back
158 output.write("Foo bar baz\n")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 159–162why, one step back
159 output.flush()
160161 result = runner.invoke(inout, [])162 assert not result.exception

Merge branch '7.x'David Lordbefore adoption7239794

line 163why, one step back
163 assert result.output == "Foo bar baz\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 164–167why, one step back
164
165166def test_nargs_envvar(runner):167 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 168why, one step back
168 @click.option("--arg", nargs=2)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 169why, one step back
169 def cmd(arg):

Merge branch '7.x'David Lordbefore adoption7239794

line 170why, one step back
170 click.echo("|".join(arg))

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 171why, one step back
171

Merge branch '7.x'David Lordbefore adoption7239794

lines 172–174why, one step back
172 result = runner.invoke(
173 cmd, [], auto_envvar_prefix="TEST", env={"TEST_ARG": "foo bar"}174 )

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 176why, one step back
176 assert result.output == "foo|bar\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 177–178why, one step back
177
178 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 179why, one step back
179 @click.option("--arg", envvar="X", nargs=2)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 180why, one step back
180 def cmd(arg):

Merge branch '7.x'David Lordbefore adoption7239794

line 181why, one step back
181 click.echo("|".join(arg))

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 182why, one step back
182

Merge branch '7.x'David Lordbefore adoption7239794

line 183why, one step back
183 result = runner.invoke(cmd, [], env={"X": "foo bar"})

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

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

Merge branch '7.x'David Lordbefore adoption7239794

line 185why, one step back
185 assert result.output == "foo|bar\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 186–189why, one step back
186
187188def test_empty_nargs(runner):189 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 190why, one step back
190 @click.argument("arg", nargs=-1)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 191why, one step back
191 def cmd(arg):

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

line 192why, one step back
192 click.echo(f"arg:{'|'.join(arg)}")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 193–195why, one step back
193
194 result = runner.invoke(cmd, [])195 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

line 196why, one step back
196 assert result.output == "arg:\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 197–198why, one step back
197
198 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 199why, one step back
199 @click.argument("arg", nargs=-1, required=True)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 200why, one step back
200 def cmd2(arg):

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

line 201why, one step back
201 click.echo(f"arg:{'|'.join(arg)}")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 202–204why, one step back
202
203 result = runner.invoke(cmd2, [])204 assert result.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

line 205why, one step back
205 assert "Missing argument 'ARG...'" in result.output

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 206–209why, one step back
206
207208def test_missing_arg(runner):209 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 210why, one step back
210 @click.argument("arg")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 211why, one step back
211 def cmd(arg):

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

line 212why, one step back
212 click.echo(f"arg:{arg}")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 213–215why, one step back
213
214 result = runner.invoke(cmd, [])215 assert result.exit_code == 2

Merge branch '7.x'David Lordbefore adoption7239794

line 216why, one step back
216 assert "Missing argument 'ARG'." in result.output

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 217–218why, one step back
217
218

Merge branch '7.x'David Lordbefore adoption2269786

lines 219–227why, one step back
219def test_missing_argument_string_cast():
220 ctx = click.Context(click.Command(""))221222 with pytest.raises(click.MissingParameter) as excinfo:223 click.Argument(["a"], required=True).full_process_value(ctx, None)224225 assert str(excinfo.value) == "missing parameter: a"226227

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 228–229why, one step back
228def test_implicit_non_required(runner):
229 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 230why, one step back
230 @click.argument("f", default="test")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 231–235why, one step back
231 def cli(f):
232 click.echo(f)233234 result = runner.invoke(cli, [])235 assert result.exit_code == 0

Merge branch '7.x'David Lordbefore adoption7239794

line 236why, one step back
236 assert result.output == "test\n"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 237–240why, one step back
237
238239def test_eat_options(runner):240 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 241–242why, one step back
241 @click.option("-f")
242 @click.argument("files", nargs=-1)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 243–247why, one step back
243 def cmd(f, files):
244 for filename in files:245 click.echo(filename)246 click.echo(f)247

Merge branch '7.x'David Lordbefore adoption7239794

lines 248–249why, one step back
248 result = runner.invoke(cmd, ["--", "-foo", "bar"])
249 assert result.output.splitlines() == ["-foo", "bar", ""]

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 250why, one step back
250

Merge branch '7.x'David Lordbefore adoption7239794

lines 251–252why, one step back
251 result = runner.invoke(cmd, ["-f", "-x", "--", "-foo", "bar"])
252 assert result.output.splitlines() == ["-foo", "bar", "-x"]

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 253–256why, one step back
253
254255def test_nargs_star_ordering(runner):256 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 257–259why, one step back
257 @click.argument("a", nargs=-1)
258 @click.argument("b")259 @click.argument("c")

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 260–263why, one step back
260 def cmd(a, b, c):
261 for arg in (a, b, c):262 click.echo(arg)263

Merge branch '7.x'David Lordbefore adoption7239794

line 264why, one step back
264 result = runner.invoke(cmd, ["a", "b", "c"])

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

line 265why, one step back
265 assert result.output.splitlines() == ["('a',)", "b", "c"]

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 266–269why, one step back
266
267268def test_nargs_specified_plus_star_ordering(runner):269 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

lines 270–272why, one step back
270 @click.argument("a", nargs=-1)
271 @click.argument("b")272 @click.argument("c", nargs=2)

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 273–276why, one step back
273 def cmd(a, b, c):
274 for arg in (a, b, c):275 click.echo(arg)276

Merge branch '7.x'David Lordbefore adoption7239794

line 277why, one step back
277 result = runner.invoke(cmd, ["a", "b", "c", "d", "e", "f"])

Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9

line 278why, one step back
278 assert result.output.splitlines() == ["('a', 'b', 'c')", "d", "('e', 'f')"]

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 279–282why, one step back
279
280281def test_defaults_for_nargs(runner):282 @click.command()

Merge branch '7.x'David Lordbefore adoption7239794

line 283why, one step back
283 @click.argument("a", nargs=2, type=int, default=(1, 2))

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

lines 284–288why, one step back
284 def cmd(a):
285 x, y = a286 click.echo(x + y)287288 result = runner.invoke(cmd, [])

Merge branch '7.x'David Lordbefore adoption7239794

line 289why, one step back
289 assert result.output.strip() == "3"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 290why, one step back
290

Merge branch '7.x'David Lordbefore adoption7239794

lines 291–292why, one step back
291 result = runner.invoke(cmd, ["3", "4"])
292 assert result.output.strip() == "7"

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 293why, one step back
293

Merge branch '7.x'David Lordbefore adoption7239794

line 294why, one step back
294 result = runner.invoke(cmd, ["3"])

Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptiona50befd

line 295why, one step back
295 assert result.exception is not None

Merge branch '7.x'David Lordbefore adoption7239794

line 296why, one step back
296 assert "argument a takes 2 values" in result.output

Merge pull request #1014 from rhgrant10/feature/574David Lordbefore adoptionb0c7523

lines 297–300why, one step back
297
298299def test_multiple_param_decls_not_allowed(runner):300 with pytest.raises(TypeError):

Merge branch '7.x'David Lordbefore adoption7239794

line 301why, one step back
301

Merge pull request #1014 from rhgrant10/feature/574David Lordbefore adoptionb0c7523

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

Merge branch '7.x'David Lordbefore adoption7239794

line 303why, one step back
303 @click.argument("x", click.Choice(["a", "b"]))

Merge pull request #1014 from rhgrant10/feature/574David Lordbefore adoptionb0c7523

lines 304–305why, one step back
304 def copy(x):
305 click.echo(x)