@@ -364,9 +364,20 @@ def test_astype_int(dtype, request):
364
364
tm .assert_extension_array_equal (result , expected )
365
365
366
366
367
- def test_astype_float (any_float_allowed_nullable_dtype ):
367
+ def test_astype_float (dtype , any_float_allowed_nullable_dtype , request ):
368
368
# Don't compare arrays (37974)
369
- ser = pd .Series (["1.1" , pd .NA , "3.3" ], dtype = "string" )
369
+
370
+ if dtype == "arrow_string" :
371
+ if any_float_allowed_nullable_dtype in {"Float32" , "Float64" }:
372
+ reason = "TypeError: Cannot interpret 'Float32Dtype()' as a data type"
373
+ else :
374
+ reason = (
375
+ "TypeError: float() argument must be a string or a number, not 'NAType'"
376
+ )
377
+ mark = pytest .mark .xfail (reason = reason )
378
+ request .node .add_marker (mark )
379
+
380
+ ser = pd .Series (["1.1" , pd .NA , "3.3" ], dtype = dtype )
370
381
371
382
result = ser .astype (any_float_allowed_nullable_dtype )
372
383
expected = pd .Series ([1.1 , np .nan , 3.3 ], dtype = any_float_allowed_nullable_dtype )
@@ -429,17 +440,25 @@ def test_reduce_missing(skipna, dtype):
429
440
assert pd .isna (result )
430
441
431
442
432
- def test_fillna_args ():
443
+ def test_fillna_args (dtype , request ):
433
444
# GH 37987
434
445
435
- arr = pd .array (["a" , pd .NA ], dtype = "string" )
446
+ if dtype == "arrow_string" :
447
+ reason = (
448
+ "AssertionError: Regex pattern \" Cannot set non-string value '1' into "
449
+ "a StringArray.\" does not match 'Scalar must be NA or str'"
450
+ )
451
+ mark = pytest .mark .xfail (reason = reason )
452
+ request .node .add_marker (mark )
453
+
454
+ arr = pd .array (["a" , pd .NA ], dtype = dtype )
436
455
437
456
res = arr .fillna (value = "b" )
438
- expected = pd .array (["a" , "b" ], dtype = "string" )
457
+ expected = pd .array (["a" , "b" ], dtype = dtype )
439
458
tm .assert_extension_array_equal (res , expected )
440
459
441
460
res = arr .fillna (value = np .str_ ("b" ))
442
- expected = pd .array (["a" , "b" ], dtype = "string" )
461
+ expected = pd .array (["a" , "b" ], dtype = dtype )
443
462
tm .assert_extension_array_equal (res , expected )
444
463
445
464
msg = "Cannot set non-string value '1' into a StringArray."
0 commit comments