| 4397 | |
| 4398 | |
| 4399 | def test_list_slice_bad_parameters(): |
| 4400 | arr = pa.array([[1]], pa.list_(pa.int8(), 1)) |
| 4401 | msg = ( |
| 4402 | r"`start`(.*) should be greater than or equal to 0 " |
| 4403 | r"and not greater than `stop`(.*)" |
| 4404 | ) |
| 4405 | with pytest.raises(pa.ArrowInvalid, match=msg): |
| 4406 | pc.list_slice(arr, -1, 1) # negative start? |
| 4407 | with pytest.raises(pa.ArrowInvalid, match=msg): |
| 4408 | pc.list_slice(arr, 2, 1) # start > stop? |
| 4409 | |
| 4410 | # Step not >= 1 |
| 4411 | msg = "`step` must be greater than or equal to 1, got: " |
| 4412 | with pytest.raises(pa.ArrowInvalid, match=msg + "0"): |
| 4413 | pc.list_slice(arr, 0, 1, step=0) |
| 4414 | with pytest.raises(pa.ArrowInvalid, match=msg + "-1"): |
| 4415 | pc.list_slice(arr, 0, 1, step=-1) |
| 4416 | |
| 4417 | |
| 4418 | def check_run_end_encode_decode(value_type, run_end_encode_opts=None): |