test_parser.py
This file
Path
tests/test_parser.py
32 lines · 915 bytes · Python
Last changed by
deprecate `OptionParser` (#2592)David Lordbefore adoption988c683
History of this fileTake it
The walk stopped after 200 commits: lines older than 19a708f point at it.
Bump actions/checkout from 3.3.0 to 3.5.0 (#2479)David Lordbefore adoption19a708f
lines 1–3why, one step back1import pytest23import clickdeprecate `OptionParser` (#2592)David Lordbefore adoption988c683
lines 4–5why, one step back4from click.parser import _OptionParser5from click.shell_completion import split_arg_stringBump actions/checkout from 3.3.0 to 3.5.0 (#2479)David Lordbefore adoption19a708f
lines 6–22why, one step back678@pytest.mark.parametrize(9 ("value", "expect"),10 [11 ("cli a b c", ["cli", "a", "b", "c"]),12 ("cli 'my file", ["cli", "my file"]),13 ("cli 'my file'", ["cli", "my file"]),14 ("cli my\\", ["cli", "my"]),15 ("cli my\\ file", ["cli", "my file"]),16 ],17)18def test_split_arg_string(value, expect):19 assert split_arg_string(value) == expect202122def test_parser_default_prefixes():deprecate `OptionParser` (#2592)David Lordbefore adoption988c683
line 23why, one step back23 parser = _OptionParser()Bump actions/checkout from 3.3.0 to 3.5.0 (#2479)David Lordbefore adoption19a708f
lines 24–28why, one step back24 assert parser._opt_prefixes == {"-", "--"}252627def test_parser_collects_prefixes():28 ctx = click.Context(click.Command("test"))deprecate `OptionParser` (#2592)David Lordbefore adoption988c683
line 29why, one step back29 parser = _OptionParser(ctx)Bump actions/checkout from 3.3.0 to 3.5.0 (#2479)David Lordbefore adoption19a708f
lines 30–32why, one step back30 click.Option("+p", is_flag=True).add_to_parser(parser, ctx)31 click.Option("!e", is_flag=True).add_to_parser(parser, ctx)32 assert parser._opt_prefixes == {"-", "--", "+", "!"}