| from __future__ import absolute_import |
| from __future__ import print_function |
| from __future__ import unicode_literals |
| from pre_commit_hooks.string_fixer import main |
| # String somewhere in the line |
| # Test escaped characters |
| # Fuck it, won't even try to fix |
| @pytest.mark.parametrize(('input_s', 'expected_output', 'expected_retval'), TESTS) |
| def test_rewrite(input_s, expected_output, expected_retval, tmpdir): |
| tmpfile = tmpdir.join('file.txt') |
| with open(tmpfile.strpath, 'w') as f: |
| retval = main([tmpfile.strpath]) |
| assert tmpfile.read() == expected_output |
| assert retval == expected_retval |