MCPcopy
hub / github.com/pyodide/pyodide / test_pyproxy_of_list_slice

Function test_pyproxy_of_list_slice

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

Source from the content-addressed store, hash-verified

1957
1958@run_in_pyodide
1959def test_pyproxy_of_list_slice(selenium):
1960 from pyodide.code import run_js
1961 from pyodide.ffi import to_js
1962
1963 a = ["ant", "bison", "camel", "duck", "elephant"]
1964 ajs = to_js(a)
1965
1966 func_strs = [
1967 "a.slice(2)",
1968 "a.slice(2, 4)",
1969 "a.slice(1, 5)",
1970 "a.slice(-2)",
1971 "a.slice(2, -1)",
1972 "a.slice()",
1973 ]
1974 for func_str in func_strs:
1975 func = run_js(f"(a) => {func_str}")
1976 assert func(a).to_py() == func(ajs).to_py()
1977
1978
1979@run_in_pyodide

Callers

nothing calls this directly

Calls 4

run_jsFunction · 0.90
to_jsFunction · 0.85
funcFunction · 0.70
to_pyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…