Skip to content

Commit a15070f

Browse files
committed
update tests
1 parent 90a405d commit a15070f

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
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
[

pandas/tests/groupby/methods/test_kurt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_groupby_kurt_arrow_float64(dtype):
4343
# Test groupby.kurt() with float64[pyarrow] and Float64 dtypes
4444
df = pd.DataFrame(
4545
{
46-
"x": [1.0, np.nan, 3.2, 4.8, 2.3, 1.9, 8.9],
46+
"x": [1.0, pd.NA, 3.2, 4.8, 2.3, 1.9, 8.9],
4747
"y": [1.6, 3.3, 3.2, 6.8, 1.3, 2.9, 9.0],
4848
},
4949
dtype=dtype,

pandas/tests/tools/test_to_numeric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ def test_to_numeric_dtype_backend_error(dtype_backend):
898898
dtype = "double[pyarrow]"
899899
else:
900900
dtype = "Float64"
901-
expected = Series([np.nan, np.nan, np.nan], dtype=dtype)
901+
expected = Series([pd.NA, pd.NA, pd.NA], dtype=dtype)
902902
tm.assert_series_equal(result, expected)
903903

904904

0 commit comments

Comments
 (0)