mirror of https://github.com/pyodide/pyodide.git
Actually add object_keys and object_values to JsProxy (#1439)
This commit is contained in:
parent
6a44597a58
commit
b342a39722
|
@ -1311,6 +1311,8 @@ JsProxy_create_subtype(int flags)
|
||||||
methods[cur_method++] = JsProxy_Dir_MethodDef;
|
methods[cur_method++] = JsProxy_Dir_MethodDef;
|
||||||
methods[cur_method++] = JsProxy_toPy_MethodDef;
|
methods[cur_method++] = JsProxy_toPy_MethodDef;
|
||||||
methods[cur_method++] = JsProxy_object_entries_MethodDef;
|
methods[cur_method++] = JsProxy_object_entries_MethodDef;
|
||||||
|
methods[cur_method++] = JsProxy_object_keys_MethodDef;
|
||||||
|
methods[cur_method++] = JsProxy_object_values_MethodDef;
|
||||||
|
|
||||||
PyTypeObject* base = &JsProxyType;
|
PyTypeObject* base = &JsProxyType;
|
||||||
int tp_flags = Py_TPFLAGS_DEFAULT;
|
int tp_flags = Py_TPFLAGS_DEFAULT;
|
||||||
|
|
|
@ -476,6 +476,20 @@ def test_register_jsmodule_docs_example(selenium_standalone):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_object_entries_keys_values(selenium):
|
||||||
|
selenium.run_js(
|
||||||
|
"""
|
||||||
|
window.x = { a : 2, b : 3, c : 4 };
|
||||||
|
pyodide.runPython(`
|
||||||
|
from js import x
|
||||||
|
assert x.object_entries().to_py() == [["a", 2], ["b", 3], ["c", 4]]
|
||||||
|
assert x.object_keys().to_py() == ["a", "b", "c"]
|
||||||
|
assert x.object_values().to_py() == [2, 3, 4]
|
||||||
|
`);
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_mixins_feature_presence(selenium):
|
def test_mixins_feature_presence(selenium):
|
||||||
result = selenium.run_js(
|
result = selenium.run_js(
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue