@@ -29,7 +29,7 @@ def df(self):
29
29
}
30
30
)
31
31
32
- def test_to_xarray_index_types (self , index_flat , df ):
32
+ def test_to_xarray_index_types (self , index_flat , df , using_infer_string ):
33
33
index = index_flat
34
34
# MultiIndex is tested in test_to_xarray_with_multiindex
35
35
if len (index ) == 0 :
@@ -51,7 +51,9 @@ def test_to_xarray_index_types(self, index_flat, df):
51
51
# datetimes w/tz are preserved
52
52
# column names are lost
53
53
expected = df .copy ()
54
- expected ["f" ] = expected ["f" ].astype (object )
54
+ expected ["f" ] = expected ["f" ].astype (
55
+ object if not using_infer_string else "string[pyarrow_numpy]"
56
+ )
55
57
expected .columns .name = None
56
58
tm .assert_frame_equal (result .to_dataframe (), expected )
57
59
@@ -63,7 +65,7 @@ def test_to_xarray_empty(self, df):
63
65
assert result .dims ["foo" ] == 0
64
66
assert isinstance (result , Dataset )
65
67
66
- def test_to_xarray_with_multiindex (self , df ):
68
+ def test_to_xarray_with_multiindex (self , df , using_infer_string ):
67
69
from xarray import Dataset
68
70
69
71
# MultiIndex
@@ -78,7 +80,9 @@ def test_to_xarray_with_multiindex(self, df):
78
80
79
81
result = result .to_dataframe ()
80
82
expected = df .copy ()
81
- expected ["f" ] = expected ["f" ].astype (object )
83
+ expected ["f" ] = expected ["f" ].astype (
84
+ object if not using_infer_string else "string[pyarrow_numpy]"
85
+ )
82
86
expected .columns .name = None
83
87
tm .assert_frame_equal (result , expected )
84
88
0 commit comments