Skip to content

Commit

Permalink
fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
c-peters committed Oct 6, 2023
1 parent 6961d90 commit c3ad1d2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions py-polars/tests/unit/io/test_lazy_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest

import polars as pl
from polars.exceptions import PolarsPanicError
from polars.testing import assert_frame_equal

if TYPE_CHECKING:
Expand Down Expand Up @@ -150,13 +149,14 @@ def test_scan_csv_schema_new_columns_dtypes(
== df1.select(["sugars", pl.col("calories").cast(pl.Int64)]).rows()
)

# expect same number of column names as there are columns in the file
with pytest.raises(PolarsPanicError, match="should be equal"):
pl.scan_csv(
file_path,
dtypes=[pl.Utf8, pl.Utf8],
new_columns=["category", "calories"],
).collect()
# partially rename columns / overwrite dtypes
df4 = pl.scan_csv(
file_path,
dtypes=[pl.Utf8, pl.Utf8],
new_columns=["category", "calories"],
).collect()
assert df4.dtypes == [pl.Utf8, pl.Utf8, pl.Float64, pl.Int64]
assert df4.columns == ["category", "calories", "fats_g", "sugars_g"]

# cannot set both 'new_columns' and 'with_column_names'
with pytest.raises(ValueError, match="mutually.exclusive"):
Expand Down

0 comments on commit c3ad1d2

Please sign in to comment.