mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Fix hook_types when calling init-templatedir
This commit is contained in:
parent
2d0927d0b3
commit
36609ee305
2 changed files with 28 additions and 6 deletions
|
|
@ -13,6 +13,20 @@ from pre_commit.error_handler import FatalError
|
|||
from testing.auto_namedtuple import auto_namedtuple
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('argv', 'expected'),
|
||||
(
|
||||
((), ['f']),
|
||||
(('--f', 'x'), ['x']),
|
||||
(('--f', 'x', '--f', 'y'), ['x', 'y']),
|
||||
),
|
||||
)
|
||||
def test_append_replace_default(argv, expected):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--f', action=main.AppendReplaceDefault, default=['f'])
|
||||
assert parser.parse_args(argv).f == expected
|
||||
|
||||
|
||||
class Args(object):
|
||||
def __init__(self, **kwargs):
|
||||
kwargs.setdefault('command', 'help')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue