File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ with CodeInterpreter() as sandbox:
8989 result = sandbox.notebook.exec_cell(code)
9090
9191# there's your image
92- image = result.display_data [0 ][ " image/ png" ]
92+ image = result.data [0 ]. png
9393
9494# example how to show the image / prove it works
9595i = base64.b64decode(image)
Original file line number Diff line number Diff line change 1+ import { CodeInterpreter } from '../src'
2+
3+ import { expect , test } from 'vitest'
4+
5+ test ( 'reconnect' , async ( ) => {
6+ let sandbox = await CodeInterpreter . create ( )
7+ await sandbox . close ( )
8+
9+ sandbox = await CodeInterpreter . reconnect ( sandbox . id )
10+
11+ const result = await sandbox . notebook . execCell ( 'x =1; x' )
12+
13+ expect ( result . text ) . toEqual ( '1' )
14+
15+ await sandbox . close ( )
16+ } )
Original file line number Diff line number Diff line change 1+ from e2b_code_interpreter .main import CodeInterpreter
2+
3+
4+ def test_basic ():
5+ with CodeInterpreter () as sandbox :
6+ sandbox_id = sandbox .id
7+
8+ sandbox = CodeInterpreter .reconnect (sandbox_id )
9+ result = sandbox .notebook .exec_cell ("x =1; x" )
10+ assert result .text == "1"
11+
12+ sandbox .close ()
You can’t perform that action at this time.
0 commit comments