MCPcopy Create free account
hub / github.com/apache/arrow / test_list_slice_bad_parameters

Function test_list_slice_bad_parameters

python/pyarrow/tests/test_compute.py:4399–4415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4397
4398
4399def 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
4418def check_run_end_encode_decode(value_type, run_end_encode_opts=None):

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected