adds top keys list of keys in hashes to put at the top of a hash

This adds custom sorting to preferencially add a list of top keys
at the start of any json hash in the json document
This commit is contained in:
dmlb2000 2016-11-03 09:41:23 -07:00
parent 8e0d7bab60
commit 845a3d5bdf
2 changed files with 105 additions and 9 deletions

View file

@ -64,6 +64,13 @@ def test_autofix_pretty_format_json(tmpdir):
ret = pretty_format_json([srcfile.strpath])
assert ret == 0
def test_orderfile_get_pretty_format():
ret = pretty_format_json(['--top-keys=alist', get_resource_path('pretty_formatted_json.json')])
assert ret == 0
def test_orderfile_get_pretty_format():
ret = pretty_format_json(['--top-keys=blah', get_resource_path('pretty_formatted_json.json')])
assert ret == 1
def test_badfile_pretty_format_json():
ret = pretty_format_json([get_resource_path('ok_yaml.yaml')])