[lang-ref] ( list_indexof_when_not_found ) ( python )
def test_list_indexof_when_not_found():
# ValueError
items = ['A', 'B', 'C', 'D', 'E']
with pytest.raises(ValueError):
items.index('Q')
# Note:
# Unlike string, list has no built-in 'indexOf' which returns -1 on not found.
# For string, find(v) returns -1, whereas index(v) raises ValueError.