MCPcopy
hub / github.com/pyodide/pyodide / test_jsarray_index

Function test_jsarray_index

src/tests/test_jsproxy.py:1774–1787  ·  view source on GitHub ↗
(selenium)

Source from the content-addressed store, hash-verified

1772
1773@run_in_pyodide
1774def test_jsarray_index(selenium):
1775 import pytest
1776
1777 from pyodide.code import run_js
1778
1779 a = run_js("[5, 7, 9, -1, 3, 5]")
1780 assert a.index(5) == 0
1781 assert a.index(5, 1) == 5
1782 with pytest.raises(ValueError, match="5 is not in list"):
1783 assert a.index(5, 1, -1) == 5
1784
1785 a.append([1, 2, 3])
1786 assert a.index([1, 2, 3]) == 6
1787 run_js("(a) => a.pop().destroy()")(a)
1788
1789
1790@run_in_pyodide

Callers

nothing calls this directly

Calls 3

run_jsFunction · 0.90
indexMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…