| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + { | ||
| 2 | + "alist": [ | ||
| 3 | + 2, | ||
| 4 | + 34, | ||
| 5 | + 234 | ||
| 6 | + ], | ||
| 7 | + "blah": null, | ||
| 8 | + "foo": "bar", | ||
| 9 | + "non_ascii": "中文にほんご한국어" | ||
| 10 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ def test_parse_indent(): | |||
| 20 | 20 | @pytest.mark.parametrize(('filename', 'expected_retval'), ( | |
| 21 | 21 | ('not_pretty_formatted_json.json', 1), | |
| 22 | 22 | ('unsorted_pretty_formatted_json.json', 1), | |
| 23 | + ('non_ascii_pretty_formatted_json.json', 1), | ||
| 23 | 24 | ('pretty_formatted_json.json', 0), | |
| 24 | 25 | )) | |
| 25 | 26 | def test_pretty_format_json(filename, expected_retval): | |
@@ -30,6 +31,7 @@ def test_pretty_format_json(filename, expected_retval): | |||
| 30 | 31 | @pytest.mark.parametrize(('filename', 'expected_retval'), ( | |
| 31 | 32 | ('not_pretty_formatted_json.json', 1), | |
| 32 | 33 | ('unsorted_pretty_formatted_json.json', 0), | |
| 34 | + ('non_ascii_pretty_formatted_json.json', 1), | ||
| 33 | 35 | ('pretty_formatted_json.json', 0), | |
| 34 | 36 | )) | |
| 35 | 37 | def test_unsorted_pretty_format_json(filename, expected_retval): | |
@@ -40,6 +42,7 @@ def test_unsorted_pretty_format_json(filename, expected_retval): | |||
| 40 | 42 | @pytest.mark.parametrize(('filename', 'expected_retval'), ( | |
| 41 | 43 | ('not_pretty_formatted_json.json', 1), | |
| 42 | 44 | ('unsorted_pretty_formatted_json.json', 1), | |
| 45 | + ('non_ascii_pretty_formatted_json.json', 1), | ||
| 43 | 46 | ('pretty_formatted_json.json', 1), | |
| 44 | 47 | ('tab_pretty_formatted_json.json', 0), | |
| 45 | 48 | )) | |
@@ -48,6 +51,11 @@ def test_tab_pretty_format_json(filename, expected_retval): | |||
| 48 | 51 | assert ret == expected_retval | |
| 49 | 52 | ||
| 50 | 53 | ||
| 54 | + def test_non_ascii_pretty_format_json(): | ||
| 55 | + ret = pretty_format_json(['--no-ensure-ascii', get_resource_path('non_ascii_pretty_formatted_json.json')]) | ||
| 56 | + assert ret == 0 | ||
| 57 | + | ||
| 58 | + | ||
| 51 | 59 | def test_autofix_pretty_format_json(tmpdir): | |
| 52 | 60 | srcfile = tmpdir.join('to_be_json_formatted.json') | |
| 53 | 61 | shutil.copyfile( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments