Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorBergeron committed Nov 13, 2024
1 parent 377fc3c commit 22d61ce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/system/small/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions tests/system/small/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 7 additions & 0 deletions tests/system/small/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 22d61ce

Please sign in to comment.