@@ -524,7 +524,6 @@ def test_arrow_array(dtype):
524
524
assert arr .equals (expected )
525
525
526
526
527
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
528
527
@pytest .mark .filterwarnings ("ignore:Passing a BlockManager:DeprecationWarning" )
529
528
def test_arrow_roundtrip (dtype , string_storage , using_infer_string ):
530
529
# roundtrip possible from arrow 1.0.0
@@ -543,13 +542,16 @@ def test_arrow_roundtrip(dtype, string_storage, using_infer_string):
543
542
assert result ["a" ].dtype == "object"
544
543
else :
545
544
assert isinstance (result ["a" ].dtype , pd .StringDtype )
546
- expected = df .astype (f"string[{ string_storage } ]" )
545
+ expected = df .astype (pd .StringDtype (string_storage , na_value = dtype .na_value ))
546
+ if using_infer_string :
547
+ expected .columns = expected .columns .astype (
548
+ pd .StringDtype (string_storage , na_value = np .nan )
549
+ )
547
550
tm .assert_frame_equal (result , expected )
548
551
# ensure the missing value is represented by NA and not np.nan or None
549
552
assert result .loc [2 , "a" ] is result ["a" ].dtype .na_value
550
553
551
554
552
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
553
555
@pytest .mark .filterwarnings ("ignore:Passing a BlockManager:DeprecationWarning" )
554
556
def test_arrow_load_from_zero_chunks (dtype , string_storage , using_infer_string ):
555
557
# GH-41040
@@ -571,7 +573,11 @@ def test_arrow_load_from_zero_chunks(dtype, string_storage, using_infer_string):
571
573
assert result ["a" ].dtype == "object"
572
574
else :
573
575
assert isinstance (result ["a" ].dtype , pd .StringDtype )
574
- expected = df .astype (f"string[{ string_storage } ]" )
576
+ expected = df .astype (pd .StringDtype (string_storage , na_value = dtype .na_value ))
577
+ if using_infer_string :
578
+ expected .columns = expected .columns .astype (
579
+ pd .StringDtype (string_storage , na_value = np .nan )
580
+ )
575
581
tm .assert_frame_equal (result , expected )
576
582
577
583
0 commit comments