-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathtest_async_default_kernels.py
More file actions
28 lines (20 loc) · 1007 Bytes
/
test_async_default_kernels.py
File metadata and controls
28 lines (20 loc) · 1007 Bytes
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
from e2b_code_interpreter.code_interpreter_async import AsyncSandbox
async def test_js_kernel(async_sandbox: AsyncSandbox):
execution = await async_sandbox.run_code(
"console.log('Hello, World!')", language="js"
)
assert execution.logs.stdout == ["Hello, World!\n"]
async def test_ts_kernel(async_sandbox: AsyncSandbox):
execution = await async_sandbox.run_code(
"const message: string = 'Hello, World!'; console.log(message);", language="ts"
)
assert execution.logs.stdout == ["Hello, World!\n"]
async def test_ts_kernel_errors(async_sandbox: AsyncSandbox):
execution = await async_sandbox.run_code(
"import x from 'module';", language="ts"
)
assert execution.error is not None
assert execution.error.name == "TypeScriptCompilerError"
async def test_ruby_kernel(async_sandbox: AsyncSandbox):
execution = await async_sandbox.run_code("puts 'Hello, World!'", language="ruby")
assert execution.logs.stdout == ["Hello, World!\n"]