mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
19 lines
603 B
Python
19 lines
603 B
Python
def test_eval_mode(wdriver):
|
|
assert wdriver.execute_script("return window.rp.pyEval('1+1')") == 2
|
|
|
|
def test_exec_mode(wdriver):
|
|
assert wdriver.execute_script("return window.rp.pyExec('1+1')") is None
|
|
|
|
def test_exec_single_mode(wdriver):
|
|
assert wdriver.execute_script("return window.rp.pyExecSingle('1+1')") == 2
|
|
assert wdriver.execute_script(
|
|
"""
|
|
var output = [];
|
|
save_output = function(text) {{
|
|
output.push(text)
|
|
}};
|
|
window.rp.pyExecSingle('1+1\\n2+2',{stdout: save_output});
|
|
return output;
|
|
"""
|
|
) == ["2\n", "4\n"]
|