File tree Expand file tree Collapse file tree 1 file changed +19
-24
lines changed Expand file tree Collapse file tree 1 file changed +19
-24
lines changed Original file line number Diff line number Diff line change @@ -173,15 +173,17 @@ def teardown_class(cls):
173
173
def test_clean_writer ():
174
174
with TemporaryDirectory () as tmpdir :
175
175
tempfile = pathlib .Path (tmpdir ) / "tmpfile.txt"
176
+
177
+ test_string = "\n " .join ([
178
+ "Top line" ,
179
+ " " ,
180
+ "Line with whitespace " ,
181
+ "Line with tabs " ,
182
+ "No newline at end of file" ,
183
+ ])
184
+
176
185
with tempfile .open ("w" ) as fp :
177
- clean_writer (
178
- """Top line
179
-
180
- Line with whitespace
181
- Line with tabs
182
- No newline at end of file""" ,
183
- fp
184
- )
186
+ clean_writer (test_string , fp )
185
187
186
188
assert tempfile .read_text () == """Top line
187
189
@@ -190,23 +192,16 @@ def test_clean_writer():
190
192
No newline at end of file
191
193
"""
192
194
# Again with lots of newlines
193
- with tempfile .open ("w" ) as fp :
194
- clean_writer (
195
- """Top line
196
-
197
- Line with whitespace
198
- Line with tabs
199
- Too many newlines
200
-
201
-
195
+ test_string = "\n " .join ([
196
+ "Top line" ,
197
+ " " ,
198
+ "Line with whitespace " ,
199
+ "Line with tabs " ,
200
+ "Too many newlines\n \n \n \n \n \n \n " ,
201
+ ])
202
202
203
-
204
-
205
-
206
-
207
- """ ,
208
- fp
209
- )
203
+ with tempfile .open ("w" ) as fp :
204
+ clean_writer (test_string , fp )
210
205
211
206
assert tempfile .read_text () == """Top line
212
207
You can’t perform that action at this time.
0 commit comments