MCPcopy
hub / github.com/pyodide/pyodide / test_pyproxy_of_list_indexOf

Function test_pyproxy_of_list_indexOf

src/tests/test_pyproxy.py:1980–1996  ·  view source on GitHub ↗
(selenium)

Source from the content-addressed store, hash-verified

1978
1979@run_in_pyodide
1980def test_pyproxy_of_list_indexOf(selenium):
1981 from pyodide.code import run_js
1982 from pyodide.ffi import to_js
1983
1984 a = ["ant", "bison", "camel", "duck", "bison"]
1985 ajs = to_js(a)
1986
1987 func_strs = [
1988 "beasts.indexOf('bison')",
1989 "beasts.indexOf('bison', 2)",
1990 "beasts.indexOf('bison', -4)",
1991 "beasts.indexOf('bison', 3)",
1992 "beasts.indexOf('giraffe')",
1993 ]
1994 for func_str in func_strs:
1995 func = run_js(f"(beasts) => {func_str}")
1996 assert func(a) == func(ajs)
1997
1998
1999@run_in_pyodide

Callers

nothing calls this directly

Calls 3

run_jsFunction · 0.90
to_jsFunction · 0.85
funcFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…