(selenium)
| 1772 | |
| 1773 | @run_in_pyodide |
| 1774 | def 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 |