-
Notifications
You must be signed in to change notification settings - Fork 210
Expand file tree
/
Copy pathtest_async_contexts.py
More file actions
38 lines (23 loc) · 1.1 KB
/
test_async_contexts.py
File metadata and controls
38 lines (23 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from e2b_code_interpreter.code_interpreter_async import AsyncSandbox
async def test_create_context_with_no_options(async_sandbox: AsyncSandbox):
context = await async_sandbox.create_code_context()
assert context.id is not None
assert context.language == "python"
assert context.cwd == "/home/user"
async def test_create_context_with_options(async_sandbox: AsyncSandbox):
context = await async_sandbox.create_code_context(
language="python",
cwd="/home/user/test",
)
assert context.id is not None
assert context.language == "python"
assert context.cwd == "/home/user/test"
async def test_remove_context(async_sandbox: AsyncSandbox):
context = await async_sandbox.create_code_context()
await async_sandbox.remove_code_context(context.id)
async def test_list_contexts(async_sandbox: AsyncSandbox):
contexts = await async_sandbox.list_code_contexts()
assert len(contexts) > 0
async def test_restart_context(async_sandbox: AsyncSandbox):
context = await async_sandbox.create_code_context()
await async_sandbox.restart_code_context(context.id)