From c3ad1d2ebce381920fd2935c1350abb3ac6a770d Mon Sep 17 00:00:00 2001 From: chielP Date: Fri, 6 Oct 2023 20:46:57 +0200 Subject: [PATCH] fix broken test --- py-polars/tests/unit/io/test_lazy_csv.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/py-polars/tests/unit/io/test_lazy_csv.py b/py-polars/tests/unit/io/test_lazy_csv.py index 9fb40f2c5c3a..0530f08dc4a9 100644 --- a/py-polars/tests/unit/io/test_lazy_csv.py +++ b/py-polars/tests/unit/io/test_lazy_csv.py @@ -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: @@ -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"):