Skip to content

Commit 72db751

Browse files
committed
Add test for sync version
1 parent 25424f1 commit 72db751

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

python/tests/async/test_async_callbacks.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ async def async_append(item):
88
return async_append
99

1010

11-
async def test_resuls(async_sandbox: AsyncSandbox):
11+
async def test_results(async_sandbox: AsyncSandbox):
1212
results = []
1313

1414
execution = await async_sandbox.run_code(
@@ -18,6 +18,16 @@ async def test_resuls(async_sandbox: AsyncSandbox):
1818
assert execution.results[0].text == "1"
1919

2020

21+
async def test_results_sync_callback(async_sandbox: AsyncSandbox):
22+
results = []
23+
24+
execution = await async_sandbox.run_code(
25+
"x = 1;x", on_result=lambda result: results.append(result)
26+
)
27+
assert len(results) == 1
28+
assert execution.results[0].text == "1"
29+
30+
2131
async def test_error(async_sandbox: AsyncSandbox):
2232
errors = []
2333
execution = await async_sandbox.run_code("xyz", on_error=async_append_fn(errors))

0 commit comments

Comments
 (0)