File tree 1 file changed +25
-1
lines changed
1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 12
12
from cwltool .main import main
13
13
from cwltool .stdfsaccess import StdFsAccess
14
14
from cwltool .update import INTERNAL_VERSION
15
- from cwltool .utils import CWLObjectType
15
+ from cwltool .utils import CWLObjectType , CONTENT_LIMIT , bytes2str_in_dicts
16
+ from cwltool .builder import content_limit_respected_read
17
+ from cwltool .errors import WorkflowException
16
18
17
19
from .util import needs_docker
18
20
@@ -214,3 +216,25 @@ def test_clt_returns_specialchar_names(tmp_path: Path) -> None:
214
216
result ["location" ]
215
217
== "keep:ae755cd1b3cff63152ff4200f4dea7e9+52/%3A%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D"
216
218
)
219
+
220
+
221
+ def test_content_limit_respected_read () -> None :
222
+ b1 = b"abcd" * 100
223
+ b1io = BytesIO (b1 )
224
+
225
+ assert (len (b1 ) < CONTENT_LIMIT )
226
+ assert (content_limit_respected_read (b1io ) == str ("abcd" * 100 ))
227
+
228
+ b2 = b"abcd" * 20000
229
+ b2io = BytesIO (b2 )
230
+
231
+ assert (len (b2 ) > CONTENT_LIMIT )
232
+ with pytest .raises (WorkflowException ):
233
+ content_limit_respected_read (b2io )
234
+
235
+ def test_bytes2str_in_dicts () -> None :
236
+ d1 = {"foo" : b"bar" }
237
+
238
+ d2 = bytes2str_in_dicts (d1 )
239
+
240
+ assert (d2 == {"foo" : "bar" })
You can’t perform that action at this time.
0 commit comments