Skip to content

Commit e9aea74

Browse files
committed
Upgrade add-trailing-comma to 0.4.1
1 parent ea227f0 commit e9aea74

11 files changed

+94
-63
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
hooks:
2828
- id: pyupgrade
2929
- repo: https://github.com/asottile/add-trailing-comma
30-
sha: v0.3.0
30+
sha: v0.4.1
3131
hooks:
3232
- id: add-trailing-comma

pre_commit_hooks/no_commit_to_branch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ def is_on_branch(protected):
1515
def main(argv=[]):
1616
parser = argparse.ArgumentParser()
1717
parser.add_argument(
18-
'-b', '--branch', default='master', help='branch to disallow commits to')
18+
'-b', '--branch', default='master', help='branch to disallow commits to',
19+
)
1920
args = parser.parse_args(argv)
2021

2122
return int(is_on_branch(args.branch))

tests/check_executables_have_shebangs_test.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,30 @@
77
from pre_commit_hooks.check_executables_have_shebangs import main
88

99

10-
@pytest.mark.parametrize('content', (
11-
b'#!/bin/bash\nhello world\n',
12-
b'#!/usr/bin/env python3.6',
13-
b'#!python',
14-
'#!☃'.encode('UTF-8'),
15-
))
10+
@pytest.mark.parametrize(
11+
'content', (
12+
b'#!/bin/bash\nhello world\n',
13+
b'#!/usr/bin/env python3.6',
14+
b'#!python',
15+
'#!☃'.encode('UTF-8'),
16+
),
17+
)
1618
def test_has_shebang(content, tmpdir):
1719
path = tmpdir.join('path')
1820
path.write(content, 'wb')
1921
assert main((path.strpath,)) == 0
2022

2123

22-
@pytest.mark.parametrize('content', (
23-
b'',
24-
b' #!python\n',
25-
b'\n#!python\n',
26-
b'python\n',
27-
'☃'.encode('UTF-8'),
24+
@pytest.mark.parametrize(
25+
'content', (
26+
b'',
27+
b' #!python\n',
28+
b'\n#!python\n',
29+
b'python\n',
30+
'☃'.encode('UTF-8'),
2831
29-
))
32+
),
33+
)
3034
def test_bad_shebang(content, tmpdir, capsys):
3135
path = tmpdir.join('path')
3236
path.write(content, 'wb')

tests/check_json_test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
from testing.util import get_resource_path
55

66

7-
@pytest.mark.parametrize(('filename', 'expected_retval'), (
8-
('bad_json.notjson', 1),
9-
('bad_json_latin1.nonjson', 1),
10-
('ok_json.json', 0),
11-
))
7+
@pytest.mark.parametrize(
8+
('filename', 'expected_retval'), (
9+
('bad_json.notjson', 1),
10+
('bad_json_latin1.nonjson', 1),
11+
('ok_json.json', 0),
12+
),
13+
)
1214
def test_check_json(capsys, filename, expected_retval):
1315
ret = check_json([get_resource_path(filename)])
1416
assert ret == expected_retval

tests/check_symlinks_test.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88

99
@pytest.mark.xfail(os.name == 'nt', reason='No symlink support on windows')
10-
@pytest.mark.parametrize(('filename', 'expected_retval'), (
11-
('broken_symlink', 1),
12-
('working_symlink', 0),
13-
))
10+
@pytest.mark.parametrize(
11+
('filename', 'expected_retval'), (
12+
('broken_symlink', 1),
13+
('working_symlink', 0),
14+
),
15+
)
1416
def test_check_symlinks(filename, expected_retval):
1517
ret = check_symlinks([get_resource_path(filename)])
1618
assert ret == expected_retval

tests/check_xml_test.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
from testing.util import get_resource_path
55

66

7-
@pytest.mark.parametrize(('filename', 'expected_retval'), (
8-
('bad_xml.notxml', 1),
9-
('ok_xml.xml', 0),
10-
))
7+
@pytest.mark.parametrize(
8+
('filename', 'expected_retval'), (
9+
('bad_xml.notxml', 1),
10+
('ok_xml.xml', 0),
11+
),
12+
)
1113
def test_check_xml(filename, expected_retval):
1214
ret = check_xml([get_resource_path(filename)])
1315
assert ret == expected_retval

tests/check_yaml_test.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
from testing.util import get_resource_path
55

66

7-
@pytest.mark.parametrize(('filename', 'expected_retval'), (
8-
('bad_yaml.notyaml', 1),
9-
('ok_yaml.yaml', 0),
10-
))
7+
@pytest.mark.parametrize(
8+
('filename', 'expected_retval'), (
9+
('bad_yaml.notyaml', 1),
10+
('ok_yaml.yaml', 0),
11+
),
12+
)
1113
def test_check_yaml(filename, expected_retval):
1214
ret = check_yaml([get_resource_path(filename)])
1315
assert ret == expected_retval

tests/debug_statement_hook_test.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,36 @@
1010

1111
@pytest.fixture
1212
def ast_with_no_debug_imports():
13-
return ast.parse("""
13+
return ast.parse(
14+
"""
1415
import foo
1516
import bar
1617
import baz
1718
from foo import bar
18-
""")
19+
""",
20+
)
1921

2022

2123
@pytest.fixture
2224
def ast_with_debug_import_form_1():
23-
return ast.parse("""
25+
return ast.parse(
26+
"""
2427
2528
import ipdb; ipdb.set_trace()
2629
27-
""")
30+
""",
31+
)
2832

2933

3034
@pytest.fixture
3135
def ast_with_debug_import_form_2():
32-
return ast.parse("""
36+
return ast.parse(
37+
"""
3338
3439
from pudb import set_trace; set_trace()
3540
36-
""")
41+
""",
42+
)
3743

3844

3945
def test_returns_no_debug_statements(ast_with_no_debug_imports):

tests/detect_aws_credentials_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ def test_get_aws_secrets_from_env(env_vars, values):
6969
{'z2rpgs5uit782eapz5l1z0y2lurtsyyk6hcfozlb'},
7070
),
7171
('aws_config_with_session_token.ini', {'foo'}),
72-
('aws_config_with_secret_and_session_token.ini',
73-
{'z2rpgs5uit782eapz5l1z0y2lurtsyyk6hcfozlb', 'foo'}),
72+
(
73+
'aws_config_with_secret_and_session_token.ini',
74+
{'z2rpgs5uit782eapz5l1z0y2lurtsyyk6hcfozlb', 'foo'},
75+
),
7476
(
7577
'aws_config_with_multiple_sections.ini',
7678
{

tests/pretty_format_json_test.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,41 @@ def test_parse_indent():
1717
parse_indent('-2')
1818

1919

20-
@pytest.mark.parametrize(('filename', 'expected_retval'), (
21-
('not_pretty_formatted_json.json', 1),
22-
('unsorted_pretty_formatted_json.json', 1),
23-
('non_ascii_pretty_formatted_json.json', 1),
24-
('pretty_formatted_json.json', 0),
25-
))
20+
@pytest.mark.parametrize(
21+
('filename', 'expected_retval'), (
22+
('not_pretty_formatted_json.json', 1),
23+
('unsorted_pretty_formatted_json.json', 1),
24+
('non_ascii_pretty_formatted_json.json', 1),
25+
('pretty_formatted_json.json', 0),
26+
),
27+
)
2628
def test_pretty_format_json(filename, expected_retval):
2729
ret = pretty_format_json([get_resource_path(filename)])
2830
assert ret == expected_retval
2931

3032

31-
@pytest.mark.parametrize(('filename', 'expected_retval'), (
32-
('not_pretty_formatted_json.json', 1),
33-
('unsorted_pretty_formatted_json.json', 0),
34-
('non_ascii_pretty_formatted_json.json', 1),
35-
('pretty_formatted_json.json', 0),
36-
))
33+
@pytest.mark.parametrize(
34+
('filename', 'expected_retval'), (
35+
('not_pretty_formatted_json.json', 1),
36+
('unsorted_pretty_formatted_json.json', 0),
37+
('non_ascii_pretty_formatted_json.json', 1),
38+
('pretty_formatted_json.json', 0),
39+
),
40+
)
3741
def test_unsorted_pretty_format_json(filename, expected_retval):
3842
ret = pretty_format_json(['--no-sort-keys', get_resource_path(filename)])
3943
assert ret == expected_retval
4044

4145

42-
@pytest.mark.parametrize(('filename', 'expected_retval'), (
43-
('not_pretty_formatted_json.json', 1),
44-
('unsorted_pretty_formatted_json.json', 1),
45-
('non_ascii_pretty_formatted_json.json', 1),
46-
('pretty_formatted_json.json', 1),
47-
('tab_pretty_formatted_json.json', 0),
48-
))
46+
@pytest.mark.parametrize(
47+
('filename', 'expected_retval'), (
48+
('not_pretty_formatted_json.json', 1),
49+
('unsorted_pretty_formatted_json.json', 1),
50+
('non_ascii_pretty_formatted_json.json', 1),
51+
('pretty_formatted_json.json', 1),
52+
('tab_pretty_formatted_json.json', 0),
53+
),
54+
)
4955
def test_tab_pretty_format_json(filename, expected_retval):
5056
ret = pretty_format_json(['--indent', '\t', get_resource_path(filename)])
5157
assert ret == expected_retval

0 commit comments

Comments
 (0)