コード例 #1
0
ファイル: test_utils.py プロジェクト: onicagroup/runway
 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
ファイル: test_compat.py プロジェクト: boto/s3transfer
 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
ファイル: test_compat.py プロジェクト: boto/s3transfer
 def test_non_file_like_obj(self):
     # Fails becase there is no seekable(), seek(), nor tell()
     self.assertFalse(seekable(object()))
コード例 #11
0
ファイル: test_compat.py プロジェクト: boto/s3transfer
 def test_seekable_fileobj(self):
     with open(self.filename, 'w') as f:
         self.assertTrue(seekable(f))
コード例 #12
0
ファイル: download.py プロジェクト: revmischa/sublime-boto3
 def is_compatible(cls, download_target, osutil):
     return seekable(download_target)