From f357ed11ca47e7595ebf96660805b02d656263cf Mon Sep 17 00:00:00 2001
From: Brock <jbrockmendel@gmail.com>
Date: Wed, 29 Jan 2025 16:21:54 -0800
Subject: [PATCH] BUG(string): from_dummies, dropna

---
 pandas/tests/frame/methods/test_dropna.py |  8 ++++----
 pandas/tests/frame/test_arithmetic.py     | 13 ++++++++++---
 pandas/tests/reshape/test_from_dummies.py |  7 +++----
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/pandas/tests/frame/methods/test_dropna.py b/pandas/tests/frame/methods/test_dropna.py
index 4a60dc09cfe07..d4f5629e6ba4b 100644
--- a/pandas/tests/frame/methods/test_dropna.py
+++ b/pandas/tests/frame/methods/test_dropna.py
@@ -4,8 +4,6 @@
 import numpy as np
 import pytest
 
-from pandas._config import using_string_dtype
-
 import pandas as pd
 from pandas import (
     DataFrame,
@@ -184,10 +182,12 @@ def test_dropna_multiple_axes(self):
         with pytest.raises(TypeError, match="supplying multiple axes"):
             inp.dropna(how="all", axis=(0, 1), inplace=True)
 
-    @pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
-    def test_dropna_tz_aware_datetime(self):
+    def test_dropna_tz_aware_datetime(self, using_infer_string):
         # GH13407
+
         df = DataFrame()
+        if using_infer_string:
+            df.columns = df.columns.astype("str")
         dt1 = datetime.datetime(2015, 1, 1, tzinfo=dateutil.tz.tzutc())
         dt2 = datetime.datetime(2015, 2, 2, tzinfo=dateutil.tz.tzutc())
         df["Time"] = [dt1]
diff --git a/pandas/tests/frame/test_arithmetic.py b/pandas/tests/frame/test_arithmetic.py
index 7ada1884feb90..aa2d5e9d23815 100644
--- a/pandas/tests/frame/test_arithmetic.py
+++ b/pandas/tests/frame/test_arithmetic.py
@@ -11,7 +11,7 @@
 import numpy as np
 import pytest
 
-from pandas._config import using_string_dtype
+from pandas.compat import HAS_PYARROW
 
 import pandas as pd
 from pandas import (
@@ -2126,12 +2126,19 @@ def test_enum_column_equality():
     tm.assert_series_equal(result, expected)
 
 
-@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
-def test_mixed_col_index_dtype():
+def test_mixed_col_index_dtype(using_infer_string):
     # GH 47382
     df1 = DataFrame(columns=list("abc"), data=1.0, index=[0])
     df2 = DataFrame(columns=list("abc"), data=0.0, index=[0])
     df1.columns = df2.columns.astype("string")
     result = df1 + df2
     expected = DataFrame(columns=list("abc"), data=1.0, index=[0])
+    if using_infer_string:
+        # df2.columns.dtype will be "str" instead of object,
+        #  so the aligned result will be "string", not object
+        if HAS_PYARROW:
+            dtype = "string[pyarrow]"
+        else:
+            dtype = "string"
+        expected.columns = expected.columns.astype(dtype)
     tm.assert_frame_equal(result, expected)
diff --git a/pandas/tests/reshape/test_from_dummies.py b/pandas/tests/reshape/test_from_dummies.py
index da1930323f464..c7b7992a78232 100644
--- a/pandas/tests/reshape/test_from_dummies.py
+++ b/pandas/tests/reshape/test_from_dummies.py
@@ -1,8 +1,6 @@
 import numpy as np
 import pytest
 
-from pandas._config import using_string_dtype
-
 from pandas import (
     DataFrame,
     Series,
@@ -364,7 +362,6 @@ def test_with_prefix_contains_get_dummies_NaN_column():
     tm.assert_frame_equal(result, expected)
 
 
-@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
 @pytest.mark.parametrize(
     "default_category, expected",
     [
@@ -401,12 +398,14 @@ def test_with_prefix_contains_get_dummies_NaN_column():
     ],
 )
 def test_with_prefix_default_category(
-    dummies_with_unassigned, default_category, expected
+    dummies_with_unassigned, default_category, expected, using_infer_string
 ):
     result = from_dummies(
         dummies_with_unassigned, sep="_", default_category=default_category
     )
     expected = DataFrame(expected)
+    if using_infer_string:
+        expected = expected.astype("str")
     tm.assert_frame_equal(result, expected)