File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 11import json
22import pathlib
3+ from io import BufferedReader
4+
35import pytest
46from unittest .mock import Mock
57
1012
1113from unittest .mock import MagicMock , patch
1214
15+ from xcengine .core import ChunkStream
16+
1317
1418def test_init_runner_invalid_image_type ():
1519 with pytest .raises (ValueError , match = 'Invalid type "int"' ):
@@ -72,3 +76,12 @@ def test_pip(mock_run):
7276 assert not inspector .is_local ("textdistance" )
7377 assert not inspector .is_local ("pip" )
7478 assert not inspector .is_local ("setuptools" )
79+
80+
81+ def test_chunk_stream ():
82+ chunks = ["123" , "456" , "789" , "abc" ]
83+ expected = "" .join (chunks ).encode ()
84+ bytegen = (chunk .encode () for chunk in chunks )
85+ chunk_stream = ChunkStream (bytegen )
86+ assert chunk_stream .readable ()
87+ assert BufferedReader (chunk_stream ).read () == expected
You can’t perform that action at this time.
0 commit comments