Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

add extra tests to sandbox_sync write

0div365af432f106
diff --git a/packages/python-sdk/tests/sync/sandbox_sync/files/test_write.py b/packages/python-sdk/tests/sync/sandbox_sync/files/test_write.py
index a9bbf419d..22bba6249 100644
--- a/packages/python-sdk/tests/sync/sandbox_sync/files/test_write.py
+++ b/packages/python-sdk/tests/sync/sandbox_sync/files/test_write.py
@@ -4,6 +4,12 @@ def test_write_file(sandbox):
filename = "test_write.txt"
content = "This is a test file."
+ # Attempt to write without path
+ try:
+ sandbox.files.write(None, content)
+ except Exception as e:
+ assert "object is not iterable" in str(e)
+
info = sandbox.files.write(filename, content)
assert info.path == f"/home/user/{filename}"
@@ -19,6 +25,12 @@ def test_write_multiple_files(sandbox):
assert isinstance(empty_info, list)
assert len(empty_info) == 0
+ # Attempt to write with None path and empty files array
+ try:
+ sandbox.files.write(None, [])
+ except Exception as e:
+ assert "object is not iterable" in str(e)
+
# Attempt to write with path and file array
try:
sandbox.files.write("/path/to/file", [{ "path": "one_test_file.txt", "data": "This is a test file." }])