示例#1
0
 def test_iter_chunksize(self):
     content = b'1234'
     body = six.BytesIO(content)
     ref_chunks = []
     for chunk in DownloadChunkIterator(body, 3):
         ref_chunks.append(chunk)
     self.assertEqual(ref_chunks, [b'123', b'4'])
示例#2
0
 def test_iter(self):
     content = b'my content'
     body = six.BytesIO(content)
     ref_chunks = []
     for chunk in DownloadChunkIterator(body, len(content)):
         ref_chunks.append(chunk)
     self.assertEqual(ref_chunks, [b'my content'])
示例#3
0
 def test_empty_content(self):
     body = six.BytesIO(b'')
     ref_chunks = []
     for chunk in DownloadChunkIterator(body, 3):
         ref_chunks.append(chunk)
     self.assertEqual(ref_chunks, [b''])