<s> import io <EOL> import pytest <EOL> from pre_commit_hooks . pretty_format_json import pretty_format_json <EOL> from testing . util import get_resource_path <EOL> @ pytest . mark . parametrize ( ( '<STR_LIT:filename>' , '<STR_LIT>' ) , ( <EOL> ( '<STR_LIT>' , <NUM_LIT:1> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:1> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ) ) <EOL> def test_pretty_format_json ( filename , expected_retval ) : <EOL> ret = pretty_format_json ( [ get_resource_path ( filename ) ] ) <EOL> assert ret == expected_retval <EOL> @ pytest . mark . parametrize ( ( '<STR_LIT:filename>' , '<STR_LIT>' ) , ( <EOL> ( '<STR_LIT>' , <NUM_LIT:1> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( '<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ) ) <EOL> def test_unsorted_pretty_format_json ( filename , expected_retval ) : <EOL> ret = pretty_format_json ( [ '<STR_LIT>' , get_resource_path ( filename ) ] ) <EOL> assert ret == expected_retval <EOL> def test_autofix_pretty_format_json ( tmpdir ) : <EOL> srcfile = tmpdir . join ( '<STR_LIT>' ) <EOL> with io . open ( get_resource_path ( '<STR_LIT>' ) ) as f : <EOL> srcfile . write_text ( f . read ( ) , '<STR_LIT>' ) <EOL> ret = pretty_format_json ( [ '<STR_LIT>' , srcfile . strpath ] ) <EOL> assert ret == <NUM_LIT:1> <EOL> ret = pretty_format_json ( [ srcfile . strpath ] ) <EOL> assert ret == <NUM_LIT:0> <EOL> def test_badfile_pretty_format_json ( ) : <EOL> ret = pretty_format_json ( [ get_resource_path ( '<STR_LIT>' ) ] ) <EOL> assert ret == <NUM_LIT:1> </s>
