Skip to content

Commit 1f6bf0f

Browse files
committed
update tests
1 parent 51306ab commit 1f6bf0f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pandas/tests/extension/test_arrow.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3537,7 +3537,10 @@ def test_cast_dictionary_different_value_dtype(arrow_type):
35373537
def test_map_numeric_na_action():
35383538
ser = pd.Series([32, 40, None], dtype="int64[pyarrow]")
35393539
result = ser.map(lambda x: 42, na_action="ignore")
3540-
expected = pd.Series([42.0, 42.0, np.nan], dtype="float64")
3540+
if using_pyarrow_strict_nans():
3541+
expected = pd.Series([42.0, 42.0, pd.NA], dtype="object")
3542+
else:
3543+
expected = pd.Series([42.0, 42.0, np.nan], dtype="float64")
35413544
tm.assert_series_equal(result, expected)
35423545

35433546

pandas/tests/frame/methods/test_convert_dtypes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import pytest
55

6+
from pandas._config import using_pyarrow_strict_nans
7+
68
import pandas.util._test_decorators as td
79

810
import pandas as pd
@@ -73,14 +75,16 @@ def test_pyarrow_dtype_backend(self):
7375
}
7476
)
7577
result = df.convert_dtypes(dtype_backend="pyarrow")
78+
79+
item = None if not using_pyarrow_strict_nans() else np.nan
7680
expected = pd.DataFrame(
7781
{
7882
"a": pd.arrays.ArrowExtensionArray(
7983
pa.array([1, 2, 3], type=pa.int32())
8084
),
8185
"b": pd.arrays.ArrowExtensionArray(pa.array(["x", "y", None])),
8286
"c": pd.arrays.ArrowExtensionArray(pa.array([True, False, None])),
83-
"d": pd.arrays.ArrowExtensionArray(pa.array([None, 100.5, 200.0])),
87+
"d": pd.arrays.ArrowExtensionArray(pa.array([item, 100.5, 200.0])),
8488
"e": pd.arrays.ArrowExtensionArray(
8589
pa.array(
8690
[

0 commit comments

Comments
 (0)