@@ -171,6 +171,12 @@ class TestMaskedArrays(base.ExtensionTests):
171171 @pytest .mark .parametrize ("na_action" , [None , "ignore" ])
172172 def test_map (self , data_missing , na_action ):
173173 result = data_missing .map (lambda x : x , na_action = na_action )
174+ if data_missing .dtype .kind != "b" :
175+ for i in range (len (result )):
176+ if result [i ] is pd .NA :
177+ result [i ] = "nan"
178+ result = result .astype ("float64" )
179+
174180 if data_missing .dtype == Float32Dtype ():
175181 # map roundtrips through objects, which converts to float64
176182 expected = data_missing .to_numpy (dtype = "float64" , na_value = np .nan )
@@ -181,10 +187,15 @@ def test_map(self, data_missing, na_action):
181187 def test_map_na_action_ignore (self , data_missing_for_sorting ):
182188 zero = data_missing_for_sorting [2 ]
183189 result = data_missing_for_sorting .map (lambda x : zero , na_action = "ignore" )
190+
184191 if data_missing_for_sorting .dtype .kind == "b" :
185192 expected = np .array ([False , pd .NA , False ], dtype = object )
186193 else :
187194 expected = np .array ([zero , np .nan , zero ])
195+ for i in range (len (result )):
196+ if result [i ] is pd .NA :
197+ result [i ] = "nan"
198+ result = result .astype ("float64" )
188199 tm .assert_numpy_array_equal (result , expected )
189200
190201 def _get_expected_exception (self , op_name , obj , other ):
0 commit comments