@@ -522,7 +522,6 @@ def test_arrow_array(dtype):
522522 assert arr .equals (expected )
523523
524524
525- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
526525@pytest .mark .filterwarnings ("ignore:Passing a BlockManager:DeprecationWarning" )
527526def test_arrow_roundtrip (dtype , string_storage , using_infer_string ):
528527 # roundtrip possible from arrow 1.0.0
@@ -541,13 +540,16 @@ def test_arrow_roundtrip(dtype, string_storage, using_infer_string):
541540 assert result ["a" ].dtype == "object"
542541 else :
543542 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+ )
545548 tm .assert_frame_equal (result , expected )
546549 # ensure the missing value is represented by NA and not np.nan or None
547550 assert result .loc [2 , "a" ] is result ["a" ].dtype .na_value
548551
549552
550- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
551553@pytest .mark .filterwarnings ("ignore:Passing a BlockManager:DeprecationWarning" )
552554def test_arrow_load_from_zero_chunks (dtype , string_storage , using_infer_string ):
553555 # GH-41040
@@ -569,7 +571,11 @@ def test_arrow_load_from_zero_chunks(dtype, string_storage, using_infer_string):
569571 assert result ["a" ].dtype == "object"
570572 else :
571573 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+ )
573579 tm .assert_frame_equal (result , expected )
574580
575581
0 commit comments