1616from pandas .tests .copy_view .util import get_array
1717
1818
19- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
2019def test_concat_frames (using_copy_on_write ):
21- df = DataFrame ({"b" : ["a" ] * 3 })
22- df2 = DataFrame ({"a" : ["a" ] * 3 })
20+ df = DataFrame ({"b" : ["a" ] * 3 }, dtype = object )
21+ df2 = DataFrame ({"a" : ["a" ] * 3 }, dtype = object )
2322 df_orig = df .copy ()
2423 result = concat ([df , df2 ], axis = 1 )
2524
@@ -41,10 +40,9 @@ def test_concat_frames(using_copy_on_write):
4140 tm .assert_frame_equal (df , df_orig )
4241
4342
44- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
4543def test_concat_frames_updating_input (using_copy_on_write ):
46- df = DataFrame ({"b" : ["a" ] * 3 })
47- df2 = DataFrame ({"a" : ["a" ] * 3 })
44+ df = DataFrame ({"b" : ["a" ] * 3 }, dtype = object )
45+ df2 = DataFrame ({"a" : ["a" ] * 3 }, dtype = object )
4846 result = concat ([df , df2 ], axis = 1 )
4947
5048 if using_copy_on_write :
@@ -203,7 +201,7 @@ def test_concat_copy_keyword(using_copy_on_write, copy):
203201 assert not np .shares_memory (get_array (df2 , "b" ), get_array (result , "b" ))
204202
205203
206- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
204+ # @pytest.mark.xfail(using_string_dtype() and HAS_PYARROW, reason="TODO(infer_string)")
207205@pytest .mark .parametrize (
208206 "func" ,
209207 [
@@ -212,8 +210,8 @@ def test_concat_copy_keyword(using_copy_on_write, copy):
212210 ],
213211)
214212def test_merge_on_key (using_copy_on_write , func ):
215- df1 = DataFrame ({"key" : ["a" , "b" , "c" ], "a" : [1 , 2 , 3 ]})
216- df2 = DataFrame ({"key" : ["a" , "b" , "c" ], "b" : [4 , 5 , 6 ]})
213+ df1 = DataFrame ({"key" : Series ( ["a" , "b" , "c" ], dtype = object ) , "a" : [1 , 2 , 3 ]})
214+ df2 = DataFrame ({"key" : Series ( ["a" , "b" , "c" ], dtype = object ) , "b" : [4 , 5 , 6 ]})
217215 df1_orig = df1 .copy ()
218216 df2_orig = df2 .copy ()
219217
@@ -267,7 +265,6 @@ def test_merge_on_index(using_copy_on_write):
267265 tm .assert_frame_equal (df2 , df2_orig )
268266
269267
270- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
271268@pytest .mark .parametrize (
272269 "func, how" ,
273270 [
@@ -276,8 +273,8 @@ def test_merge_on_index(using_copy_on_write):
276273 ],
277274)
278275def test_merge_on_key_enlarging_one (using_copy_on_write , func , how ):
279- df1 = DataFrame ({"key" : ["a" , "b" , "c" ], "a" : [1 , 2 , 3 ]})
280- df2 = DataFrame ({"key" : ["a" , "b" ], "b" : [4 , 5 ]})
276+ df1 = DataFrame ({"key" : Series ( ["a" , "b" , "c" ], dtype = object ) , "a" : [1 , 2 , 3 ]})
277+ df2 = DataFrame ({"key" : Series ( ["a" , "b" ], dtype = object ) , "b" : [4 , 5 ]})
281278 df1_orig = df1 .copy ()
282279 df2_orig = df2 .copy ()
283280
@@ -321,9 +318,13 @@ def test_merge_copy_keyword(using_copy_on_write, copy):
321318 assert not np .shares_memory (get_array (df2 , "b" ), get_array (result , "b" ))
322319
323320
324- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
321+ @pytest .mark .xfail (
322+ using_string_dtype () and HAS_PYARROW ,
323+ reason = "TODO(infer_string); result.index infers str dtype while both "
324+ "df1 and df2 index are object." ,
325+ )
325326def test_join_on_key (using_copy_on_write ):
326- df_index = Index (["a" , "b" , "c" ], name = "key" )
327+ df_index = Index (["a" , "b" , "c" ], name = "key" , dtype = object )
327328
328329 df1 = DataFrame ({"a" : [1 , 2 , 3 ]}, index = df_index .copy (deep = True ))
329330 df2 = DataFrame ({"b" : [4 , 5 , 6 ]}, index = df_index .copy (deep = True ))
@@ -355,9 +356,8 @@ def test_join_on_key(using_copy_on_write):
355356 tm .assert_frame_equal (df2 , df2_orig )
356357
357358
358- @pytest .mark .xfail (using_string_dtype () and HAS_PYARROW , reason = "TODO(infer_string)" )
359359def test_join_multiple_dataframes_on_key (using_copy_on_write ):
360- df_index = Index (["a" , "b" , "c" ], name = "key" )
360+ df_index = Index (["a" , "b" , "c" ], name = "key" , dtype = object )
361361
362362 df1 = DataFrame ({"a" : [1 , 2 , 3 ]}, index = df_index .copy (deep = True ))
363363 dfs_list = [
0 commit comments