@@ -316,35 +316,42 @@ def mock_iter_content(chunk_size):
316316 assert len (content_chunks ) == expected_chunks # correct number of chunks
317317 assert all (len (c ) <= chunk_size for c in content_chunks ) # chunks don't exceed size
318318
319+
319320def test_is_seekable_stream ():
320321 client = _BaseClient ()
321322
322323 # Test various input types that are not streams.
323- assert not client ._is_seekable_stream (None ) # None
324- assert not client ._is_seekable_stream ("string data" ) # str
325- assert not client ._is_seekable_stream (b"binary data" ) # bytes
326- assert not client ._is_seekable_stream (["list" , "data" ]) # list
327- assert not client ._is_seekable_stream (42 ) # int
328-
324+ assert not client ._is_seekable_stream (None ) # None
325+ assert not client ._is_seekable_stream ("string data" ) # str
326+ assert not client ._is_seekable_stream (b"binary data" ) # bytes
327+ assert not client ._is_seekable_stream (["list" , "data" ]) # list
328+ assert not client ._is_seekable_stream (42 ) # int
329+
329330 # Test non-seekable stream.
330331 non_seekable = io .BytesIO (b"test data" )
331332 non_seekable .seekable = lambda : False
332333 assert not client ._is_seekable_stream (non_seekable )
333-
334+
334335 # Test seekable streams.
335- assert client ._is_seekable_stream (io .BytesIO (b"test data" )) # BytesIO
336- assert client ._is_seekable_stream (io .StringIO ("test data" )) # StringIO
337-
336+ assert client ._is_seekable_stream (io .BytesIO (b"test data" )) # BytesIO
337+ assert client ._is_seekable_stream (io .StringIO ("test data" )) # StringIO
338+
338339 # Test file objects.
339340 with open (__file__ , 'rb' ) as f :
340- assert client ._is_seekable_stream (f ) # File object
341-
341+ assert client ._is_seekable_stream (f ) # File object
342+
342343 # Test custom seekable stream.
343344 class CustomSeekableStream (io .IOBase ):
344- def seekable (self ): return True
345- def seek (self , offset , whence = 0 ): return 0
346- def tell (self ): return 0
347-
345+
346+ def seekable (self ):
347+ return True
348+
349+ def seek (self , offset , whence = 0 ):
350+ return 0
351+
352+ def tell (self ):
353+ return 0
354+
348355 assert client ._is_seekable_stream (CustomSeekableStream ())
349356
350357
0 commit comments