Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Jan 31, 2025
1 parent 316a7b6 commit b3607b3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions py-polars/tests/unit/operations/test_cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,3 +698,19 @@ def test_cast_python_dtypes() -> None:
assert s.cast(float).dtype == pl.Float64
assert s.cast(bool).dtype == pl.Boolean
assert s.cast(str).dtype == pl.String


def test_overflowing_cast_literals_21023() -> None:
for optimized in [True, False]:
assert_frame_equal(
(
pl.LazyFrame()
.select(
pl.lit(pl.Series([128], dtype=pl.Int64)).cast(
pl.Int8, wrap_numerical=True
)
)
.collect(optimized=optimized)
),
pl.Series([-128], dtype=pl.Int8).to_frame(),
)

0 comments on commit b3607b3

Please sign in to comment.