Debian Codegraph @

pypy/module/array/test/apptest_array.py

raw symbols SCIP
1 # spaceconfig = {"usemodules": ["array"]}
2 import pytest
3 from array import array
4
5 def test_index_positions():
6 a = array('i', [1, 2, 3, 1, 2, 1])
7 assert a.index(1, start=2) == 3
8 with pytest.raises(ValueError):
9 a.index(1, start=1, stop=3)
10
11 def test_index_start_stop_negative():
12 a = array('i', [1, 2, 3, 1, 2, 1])
13 assert a.index(1, start=-3) == 3
14 assert a.index(1, start=-300000) == 0
15 assert a.index(1, start=1, stop=-1) == 3
16 with pytest.raises(ValueError):
17 a.index(1, start=1, stop=-1000)
18
19
20 def test_array_is_mutable_sequence():
21 from _collections_abc import MutableSequence
22 assert isinstance(array("B"), MutableSequence)