File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import itertools
2+
13import pytest
24
35import obstore as obs
@@ -39,3 +41,33 @@ def test_put_mode():
3941 obs .put (store , "file1.txt" , b"foo" , mode = "create" )
4042
4143 assert obs .get (store , "file1.txt" ).bytes () == b"bar"
44+
45+
46+ @pytest .mark .asyncio
47+ async def test_put_async_iterable ():
48+ store = MemoryStore ()
49+
50+ data = b"the quick brown fox jumps over the lazy dog," * 50_000
51+ path = "big-data.txt"
52+
53+ await obs .put_async (store , path , data )
54+
55+ resp = await obs .get_async (store , path )
56+ stream = resp .stream (min_chunk_size = 0 )
57+ new_path = "new-path.txt"
58+ await obs .put_async (store , new_path , stream )
59+
60+ assert obs .get (store , new_path ).bytes () == data
61+
62+
63+ def test_put_sync_iterable ():
64+ store = MemoryStore ()
65+
66+ b = b"the quick brown fox jumps over the lazy dog,"
67+ iterator = itertools .repeat (b , 50_000 )
68+ data = b * 50_000
69+ path = "big-data.txt"
70+
71+ obs .put (store , path , iterator )
72+
73+ assert obs .get (store , path ).bytes () == data
You can’t perform that action at this time.
0 commit comments