Skip to content

Commit 05ab09a

Browse files
committed
Add tests to make codecov happy.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <[email protected]>
1 parent aea67f7 commit 05ab09a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tests/test_path_checks.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
from cwltool.main import main
1313
from cwltool.stdfsaccess import StdFsAccess
1414
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
1618

1719
from .util import needs_docker
1820

@@ -214,3 +216,25 @@ def test_clt_returns_specialchar_names(tmp_path: Path) -> None:
214216
result["location"]
215217
== "keep:ae755cd1b3cff63152ff4200f4dea7e9+52/%3A%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D"
216218
)
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"})

0 commit comments

Comments
 (0)