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