Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Nov 6, 2024
1 parent c8a6d46 commit ba1175e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions py-polars/tests/unit/operations/namespaces/array/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,14 @@ def test_array_get() -> None:
assert_frame_equal(out_df, expected_df)

# Out-of-bounds index literal.
with pytest.raises(ComputeError, match="get index 100 is out of bounds"):
with pytest.raises(
ComputeError, match=r"get index 100 is out of bounds for array\(width=4\)"
):
out = s.arr.get(100, null_on_oob=False)

with pytest.raises(ComputeError, match="get index -3 is out of bounds"):
with pytest.raises(
ComputeError, match=r"get index -3 is out of bounds for array\(width=2\)"
):
pl.Series([[1, 2]], dtype=pl.Array(pl.Int32, 2)).arr.get(-3)

# Negative index literal.
Expand All @@ -161,7 +165,9 @@ def test_array_get() -> None:
assert_series_equal(out, expected)

# Test index expr.
with pytest.raises(ComputeError, match="get index 100 is out of bounds"):
with pytest.raises(
ComputeError, match=r"get index 100 is out of bounds for array\(width=4\)"
):
out = s.arr.get(pl.Series([1, -2, 100]), null_on_oob=False)

out = s.arr.get(pl.Series([1, -2, 0]), null_on_oob=False)
Expand Down

0 comments on commit ba1175e

Please sign in to comment.