File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -578,7 +578,7 @@ def _file_context_manager(filename_or_object, mode='r'):
578
578
A file-like object to be used via python's "with [context] as buffer:"
579
579
syntax.
580
580
"""
581
-
581
+
582
582
if hasattr (filename_or_object , "read" ):
583
583
# already a file-like object
584
584
context = contextlib .nullcontext (filename_or_object )
Original file line number Diff line number Diff line change @@ -264,20 +264,20 @@ def test__file_context_manager():
264
264
filename = os .path .join (td , 'test.txt' )
265
265
with open (filename , 'w' ) as fh :
266
266
fh .write ('test content' )
267
-
267
+
268
268
# test with filename as string:
269
269
with tools ._file_context_manager (filename ) as obj :
270
270
assert obj .read () == "test content"
271
-
271
+
272
272
# test with filename as Path:
273
273
with tools ._file_context_manager (Path (filename )) as obj :
274
274
assert obj .read () == "test content"
275
-
275
+
276
276
# test with file object:
277
277
with open (filename , "r" ) as f :
278
278
with tools ._file_context_manager (f ) as obj :
279
279
assert obj .read () == "test content"
280
-
280
+
281
281
# test with buffer:
282
282
buffer = StringIO ("test content" )
283
283
with tools ._file_context_manager (buffer ) as obj :
You can’t perform that action at this time.
0 commit comments