@@ -146,24 +146,29 @@ def test_empty_object_with_newline(tmpdir):
146146 ret = main (["--empty-object-with-newline" , str (sameline )])
147147 assert ret == 1
148148
149+ # a template to be compared against.
149150 multiline = get_resource_path ("empty_object_json_multiline.json" )
150- to_be_formatted_sameline = tmpdir .join (
151- "not_pretty_formatted_empty_object_json_sameline.json"
152- )
153- shutil .copyfile (str (sameline ), str (to_be_formatted_sameline ))
154151
155152 # file has empty object with newline => expect fail with default settings
156153 ret = main ([str (multiline )])
157154 assert ret == 1
158155
159- # now launch the autofix with empty object with newline support on that file
156+ # launch the autofix with empty object with newline support on that file
157+ to_be_formatted_sameline = tmpdir .join (
158+ "not_pretty_formatted_empty_object_json_sameline.json"
159+ )
160+ shutil .copyfile (str (sameline ), str (to_be_formatted_sameline ))
160161 ret = main (
161- ["--autofix" , "--empty-object-with-newline" , str (to_be_formatted_sameline )]
162+ ["--autofix" ,
163+ "--empty-object-with-newline" ,
164+ str (to_be_formatted_sameline )]
162165 )
163166 # it should have formatted it and don't raise an error code
167+ # to not stop the the commit
164168 assert ret == 0
165169
166- # file was formatted (shouldn't trigger linter with --empty-object-with-newline switch)
170+ # file was formatted (shouldn't trigger linter with
171+ # --empty-object-with-newline switch)
167172 ret = main (["--empty-object-with-newline" , str (to_be_formatted_sameline )])
168173 assert ret == 0
169174 assert filecmp .cmp (to_be_formatted_sameline , multiline )
0 commit comments