示例#1
0
def test_validate_indices_high():
    indices = np.asarray([0, 1, 2])
    with pytest.raises(IndexError, match="indices are out"):
        validate_indices(indices, 2)
示例#2
0
def test_validate_indices_empty():
    with pytest.raises(IndexError, match="indices are out"):
        validate_indices(np.array([0, 1]), 0)
示例#3
0
def test_validate_indices_ok():
    indices = np.asarray([0, 1])
    validate_indices(indices, 2)
    validate_indices(indices[:0], 0)
    validate_indices(np.array([-1, -1]), 0)
示例#4
0
def test_validate_indices_low():
    indices = np.asarray([0, -2])
    with pytest.raises(ValueError, match="'indices' contains"):
        validate_indices(indices, 2)
示例#5
0
def test_validate_indices_high():
    indices = np.asarray([0, 1, 2])
    with tm.assert_raises_regex(IndexError, "indices are out"):
        validate_indices(indices, 2)
示例#6
0
def test_validate_indices_empty():
    with tm.assert_raises_regex(IndexError, "indices are out"):
        validate_indices(np.array([0, 1]), 0)
示例#7
0
def test_validate_indices_low():
    indices = np.asarray([0, -2])
    with tm.assert_raises_regex(ValueError, "'indices' contains"):
        validate_indices(indices, 2)
示例#8
0
def test_validate_indices_ok():
    indices = np.asarray([0, 1])
    validate_indices(indices, 2)
    validate_indices(indices[:0], 0)
    validate_indices(np.array([-1, -1]), 0)
示例#9
0
def test_validate_indices_empty():
    with pytest.raises(IndexError, match="indices are out"):
        validate_indices(np.array([0, 1]), 0)
示例#10
0
def test_validate_indices_high():
    indices = np.asarray([0, 1, 2])
    with pytest.raises(IndexError, match="indices are out"):
        validate_indices(indices, 2)
示例#11
0
def test_validate_indices_low():
    indices = np.asarray([0, -2])
    with pytest.raises(ValueError, match="'indices' contains"):
        validate_indices(indices, 2)