Inline tuple parameterized test tuple

This commit is contained in:
Daniel Gallagher 2017-06-25 09:48:16 -07:00
parent d188f2ecf8
commit 89ddf17888

View file

@ -5,8 +5,9 @@ from pre_commit_hooks.file_contents_sorter import main
from pre_commit_hooks.file_contents_sorter import PASS from pre_commit_hooks.file_contents_sorter import PASS
# Input, expected return value, expected output @pytest.mark.parametrize(
TESTS = ( ('input_s', 'expected_retval', 'output'),
(
(b'', PASS, b''), (b'', PASS, b''),
(b'lonesome\n', PASS, b'lonesome\n'), (b'lonesome\n', PASS, b'lonesome\n'),
(b'missing_newline', PASS, b'missing_newline'), (b'missing_newline', PASS, b'missing_newline'),
@ -17,9 +18,7 @@ TESTS = (
(b'mag ical \n tre vor\n', FAIL, b' tre vor\nmag ical \n'), (b'mag ical \n tre vor\n', FAIL, b' tre vor\nmag ical \n'),
(b'@\n-\n_\n#\n', FAIL, b'#\n-\n@\n_\n'), (b'@\n-\n_\n#\n', FAIL, b'#\n-\n@\n_\n'),
) )
)
@pytest.mark.parametrize(('input_s', 'expected_retval', 'output'), TESTS)
def test_integration(input_s, expected_retval, output, tmpdir): def test_integration(input_s, expected_retval, output, tmpdir):
path = tmpdir.join('file.txt') path = tmpdir.join('file.txt')
path.write_binary(input_s) path.write_binary(input_s)