From f60e43efda8602d77fb4d71b74adeffe437b2d90 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Wed, 3 Feb 2021 14:49:01 -0800 Subject: [PATCH] TST py->js->py conversion for list and dict (#1188) --- src/tests/test_typeconversions.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/tests/test_typeconversions.py b/src/tests/test_typeconversions.py index 55f98b7d3..cfeb94532 100644 --- a/src/tests/test_typeconversions.py +++ b/src/tests/test_typeconversions.py @@ -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( """