TST py->js->py conversion for list and dict (#1188)

This commit is contained in:
Hood Chatham 2021-02-03 14:49:01 -08:00 committed by GitHub
parent b3a965a1f6
commit f60e43efda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 4 deletions

View File

@ -243,26 +243,36 @@ def test_recursive_dict_to_js(selenium_standalone):
selenium_standalone.run_js("x = pyodide.pyimport('x').deepCopyToJavascript();")
def test_list_from_js(selenium):
def test_list_js2py2js(selenium):
selenium.run_js("window.x = [1,2,3];")
assert_js_to_py_to_js(selenium, "x")
def test_dict_from_js(selenium):
def test_dict_js2py2js(selenium):
selenium.run_js("window.x = { a : 1, b : 2, 0 : 3 };")
assert_js_to_py_to_js(selenium, "x")
def test_error_from_js(selenium):
def test_error_js2py2js(selenium):
selenium.run_js("window.err = new Error('hello there?');")
assert_js_to_py_to_js(selenium, "err")
def test_error_from_python(selenium):
def test_error_py2js2py(selenium):
selenium.run("err = Exception('hello there?');")
assert_py_to_js_to_py(selenium, "err")
def test_list_py2js2py(selenium):
selenium.run("x = ['a', 'b']")
assert_py_to_js_to_py(selenium, "x")
def test_dict_py2js2py(selenium):
selenium.run("x = {'a' : 5, 'b' : 1}")
assert_py_to_js_to_py(selenium, "x")
def test_jsproxy_attribute_error(selenium):
selenium.run_js(
"""