예제 #1
0
 def test_can_make_stream_unseekable(self) -> None:
     """Test can make stream unseekable."""
     fileobj = BytesIO(b"foobar")
     assert seekable(fileobj)
     nonseekable_fileobj = NonSeekableStream(fileobj)
     assert not seekable(nonseekable_fileobj)
     assert nonseekable_fileobj.read() == b"foobar"
예제 #2
0
파일: test_utils.py 프로젝트: aws/aws-cli
 def test_can_make_stream_unseekable(self):
     fileobj = StringIO("foobar")
     self.assertTrue(seekable(fileobj))
     nonseekable_fileobj = NonSeekableStream(fileobj)
     self.assertFalse(seekable(nonseekable_fileobj))
     self.assertEqual(nonseekable_fileobj.read(), "foobar")
 def test_can_make_stream_unseekable(self):
     fileobj = StringIO('foobar')
     self.assertTrue(seekable(fileobj))
     nonseekable_fileobj = NonSeekableStream(fileobj)
     self.assertFalse(seekable(nonseekable_fileobj))
     self.assertEqual(nonseekable_fileobj.read(), 'foobar')
예제 #4
0
 def is_compatible(cls, download_target, osutil):
     return seekable(download_target)
예제 #5
0
 def is_compatible(cls, upload_source):
     return readable(upload_source) and seekable(upload_source)
예제 #6
0
 def test_non_seekable_oserror(self):
     # Should return False if OSError is thrown.
     with open(self.filename, 'w') as f:
         self.assertFalse(seekable(ErrorRaisingSeekWrapper(f, OSError())))
예제 #7
0
 def test_non_file_like_obj(self):
     # Fails becase there is no seekable(), seek(), nor tell()
     self.assertFalse(seekable(object()))
예제 #8
0
 def test_seekable_fileobj(self):
     with open(self.filename, 'w') as f:
         self.assertTrue(seekable(f))
예제 #9
0
 def test_non_seekable_oserror(self):
     # Should return False if OSError is thrown.
     with open(self.filename, 'w') as f:
         self.assertFalse(seekable(ErrorRaisingSeekWrapper(f, OSError())))
예제 #10
0
 def test_non_file_like_obj(self):
     # Fails becase there is no seekable(), seek(), nor tell()
     self.assertFalse(seekable(object()))
예제 #11
0
 def test_seekable_fileobj(self):
     with open(self.filename, 'w') as f:
         self.assertTrue(seekable(f))
예제 #12
0
 def is_compatible(cls, download_target, osutil):
     return seekable(download_target)