Skip to content

Commit e191a8c

Browse files
kokesvictor
authored and
victor
committed
TST: Streaming of S3 files (pandas-dev#22520)
1 parent 0f2ab7c commit e191a8c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pandas/tests/io/test_s3.py

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import pytest
2+
3+
from pandas import read_csv
4+
from pandas.compat import BytesIO
15
from pandas.io.common import is_s3_url
26

37

@@ -6,3 +10,18 @@ class TestS3URL(object):
610
def test_is_s3_url(self):
711
assert is_s3_url("s3://pandas/somethingelse.com")
812
assert not is_s3_url("s4://pandas/somethingelse.com")
13+
14+
15+
def test_streaming_s3_objects():
16+
# GH17135
17+
# botocore gained iteration support in 1.10.47, can now be used in read_*
18+
pytest.importorskip('botocore', minversion='1.10.47')
19+
from botocore.response import StreamingBody
20+
21+
data = [
22+
b'foo,bar,baz\n1,2,3\n4,5,6\n',
23+
b'just,the,header\n',
24+
]
25+
for el in data:
26+
body = StreamingBody(BytesIO(el), content_length=len(el))
27+
read_csv(body)

0 commit comments

Comments
 (0)