<s> from __future__ import absolute_import <EOL> from __future__ import print_function <EOL> from __future__ import unicode_literals <EOL> import textwrap <EOL> import pytest <EOL> from pre_commit_hooks . string_fixer import main <EOL> TESTS = ( <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:0> ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" , <NUM_LIT:1> ) , <EOL> ( r'<STR_LIT>' , r'<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( r'<STR_LIT>' , r'<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( r"<STR_LIT>" , r"<STR_LIT>" , <NUM_LIT:0> ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" , <NUM_LIT:1> ) , <EOL> ( r'<STR_LIT>' , r'<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( <EOL> textwrap . dedent ( """<STR_LIT>""" ) , <EOL> textwrap . dedent ( """<STR_LIT>""" ) , <EOL> <NUM_LIT:1> , <EOL> ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" , <NUM_LIT:1> ) , <EOL> ) <EOL> @ pytest . mark . parametrize ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , TESTS ) <EOL> def test_rewrite ( input_s , output , expected_retval , tmpdir ) : <EOL> tmpfile = tmpdir . join ( '<STR_LIT>' ) <EOL> with open ( tmpfile . strpath , '<STR_LIT:w>' ) as f : <EOL> f . write ( input_s ) <EOL> retval = main ( [ tmpfile . strpath ] ) <EOL> assert tmpfile . read ( ) == output <EOL> assert retval == expected_retval </s>
