diff --git a/tests/system/small/test_dataframe.py b/tests/system/small/test_dataframe.py index 02b771a1bd..f69eb2eb4a 100644 --- a/tests/system/small/test_dataframe.py +++ b/tests/system/small/test_dataframe.py @@ -3687,6 +3687,12 @@ def test_df_add_suffix(scalars_df_index, scalars_pandas_df_index, axis): ) +def test_df_astype_error_error(session): + input = pd.DataFrame(["hello", "world", "3.11", "4000"]) + with pytest.raises(ValueError): + session.read_pandas(input).astype("Float64", errors="bad_value") + + def test_df_columns_filter_items(scalars_df_index, scalars_pandas_df_index): if pd.__version__.startswith("2.0") or pd.__version__.startswith("1."): pytest.skip("pandas filter items behavior different pre-2.1") diff --git a/tests/system/small/test_index.py b/tests/system/small/test_index.py index d68cf6c3f3..cdf4fa6511 100644 --- a/tests/system/small/test_index.py +++ b/tests/system/small/test_index.py @@ -123,6 +123,12 @@ def test_index_astype(scalars_df_index, scalars_pandas_df_index): pd.testing.assert_index_equal(bf_result, pd_result) +def test_index_astype_error_error(session): + input = pd.Index(["hello", "world", "3.11", "4000"]) + with pytest.raises(ValueError): + session.read_pandas(input).astype("Float64", errors="bad_value") + + def test_index_any(scalars_df_index, scalars_pandas_df_index): bf_result = scalars_df_index.set_index("int64_col").index.any() pd_result = scalars_pandas_df_index.set_index("int64_col").index.any() diff --git a/tests/system/small/test_series.py b/tests/system/small/test_series.py index a63c867c48..d83dfe6de0 100644 --- a/tests/system/small/test_series.py +++ b/tests/system/small/test_series.py @@ -3103,6 +3103,7 @@ def foo(x): ("int64_col", "time64[us][pyarrow]"), ("bool_col", "Int64"), ("bool_col", "string[pyarrow]"), + ("bool_col", "Float64"), ("string_col", "binary[pyarrow]"), ("bytes_col", "string[pyarrow]"), # pandas actually doesn't let folks convert to/from naive timestamp and @@ -3155,6 +3156,12 @@ def test_astype_safe(session): pd.testing.assert_series_equal(result, exepcted) +def test_series_astype_error_error(session): + input = pd.Series(["hello", "world", "3.11", "4000"]) + with pytest.raises(ValueError): + session.read_pandas(input).astype("Float64", errors="bad_value") + + @skip_legacy_pandas def test_astype_numeric_to_int(scalars_df_index, scalars_pandas_df_index): column = "numeric_col"