@@ -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,15 @@ 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
+ expected .columns = expected .columns .astype (
545
+ pd .StringDtype (string_storage , na_value = np .nan )
546
+ )
545
547
tm .assert_frame_equal (result , expected )
546
548
# ensure the missing value is represented by NA and not np.nan or None
547
549
assert result .loc [2 , "a" ] is result ["a" ].dtype .na_value
548
550
549
551
550
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
551
552
@pytest .mark .filterwarnings ("ignore:Passing a BlockManager:DeprecationWarning" )
552
553
def test_arrow_load_from_zero_chunks (dtype , string_storage , using_infer_string ):
553
554
# GH-41040
@@ -569,7 +570,10 @@ def test_arrow_load_from_zero_chunks(dtype, string_storage, using_infer_string):
569
570
assert result ["a" ].dtype == "object"
570
571
else :
571
572
assert isinstance (result ["a" ].dtype , pd .StringDtype )
572
- expected = df .astype (f"string[{ string_storage } ]" )
573
+ expected = df .astype (pd .StringDtype (string_storage , na_value = dtype .na_value ))
574
+ expected .columns = expected .columns .astype (
575
+ pd .StringDtype (string_storage , na_value = np .nan )
576
+ )
573
577
tm .assert_frame_equal (result , expected )
574
578
575
579
0 commit comments