mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 12:06:53 +00:00
Add autopep8-wrapper hook.
This commit is contained in:
parent
0121199c0a
commit
86b1c9da8e
5 changed files with 62 additions and 0 deletions
24
tests/autopep8_wrapper_test.py
Normal file
24
tests/autopep8_wrapper_test.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import io
|
||||
import os.path
|
||||
import pytest
|
||||
|
||||
from pre_commit_hooks.autopep8_wrapper import main
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('input_src', 'expected_ret', 'output_src'),
|
||||
(
|
||||
('print(1 + 2)\n', 1, 'print(1 + 2)\n'),
|
||||
('print(1 + 2)\n', 0, 'print(1 + 2)\n'),
|
||||
),
|
||||
)
|
||||
def test_main_failing(tmpdir, input_src, expected_ret, output_src):
|
||||
filename = os.path.join(tmpdir.strpath, 'test.py')
|
||||
with io.open(filename, 'w') as file_obj:
|
||||
file_obj.write(input_src)
|
||||
ret = main([filename, '-i', '-v'])
|
||||
assert ret == expected_ret
|
||||
assert io.open(filename).read() == output_src
|
||||
Loading…
Add table
Add a link
Reference in a new issue