mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
15d9beba94
commit
44843a8906
2 changed files with 18 additions and 13 deletions
|
|
@ -165,7 +165,7 @@ def test_empty_object_with_newline(tmpdir):
|
|||
assert ret == 1
|
||||
|
||||
# a template to be compared against.
|
||||
multiline = get_resource_path("empty_object_json_multiline.json")
|
||||
multiline = get_resource_path('empty_object_json_multiline.json')
|
||||
|
||||
# file has empty object with newline => expect fail with default settings
|
||||
ret = main([str(multiline)])
|
||||
|
|
@ -173,20 +173,22 @@ def test_empty_object_with_newline(tmpdir):
|
|||
|
||||
# launch the autofix with empty object with newline support on that file
|
||||
to_be_formatted_sameline = tmpdir.join(
|
||||
"not_pretty_formatted_empty_object_json_sameline.json"
|
||||
'not_pretty_formatted_empty_object_json_sameline.json',
|
||||
)
|
||||
shutil.copyfile(str(sameline), str(to_be_formatted_sameline))
|
||||
ret = main(
|
||||
["--autofix",
|
||||
"--empty-object-with-newline",
|
||||
str(to_be_formatted_sameline)]
|
||||
[
|
||||
'--autofix',
|
||||
'--empty-object-with-newline',
|
||||
str(to_be_formatted_sameline),
|
||||
],
|
||||
)
|
||||
# it should have formatted it and don't raise an error code
|
||||
# to not stop the the commit
|
||||
assert ret == 0
|
||||
|
||||
# file was formatted (shouldn't trigger linter with
|
||||
# file was formatted (shouldn't trigger linter with
|
||||
# --empty-object-with-newline switch)
|
||||
ret = main(["--empty-object-with-newline", str(to_be_formatted_sameline)])
|
||||
ret = main(['--empty-object-with-newline', str(to_be_formatted_sameline)])
|
||||
assert ret == 0
|
||||
assert filecmp.cmp(to_be_formatted_sameline, multiline)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue