55import numpy as np
66import pytest
77
8- from pandas ._config import using_string_dtype
9-
108from pandas .errors import ParserError
119
1210import pandas as pd
@@ -422,20 +420,18 @@ def test_to_csv_empty(self):
422420 result , expected = self ._return_result_expected (df , 1000 )
423421 tm .assert_frame_equal (result , expected , check_column_type = False )
424422
425- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
426423 @pytest .mark .slow
427424 def test_to_csv_chunksize (self ):
428425 chunksize = 1000
429426 rows = chunksize // 2 + 1
430427 df = DataFrame (
431428 np .ones ((rows , 2 )),
432- columns = Index (list ("ab" ), dtype = object ),
429+ columns = Index (list ("ab" )),
433430 index = MultiIndex .from_arrays ([range (rows ) for _ in range (2 )]),
434431 )
435432 result , expected = self ._return_result_expected (df , chunksize , rnlvl = 2 )
436433 tm .assert_frame_equal (result , expected , check_names = False )
437434
438- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
439435 @pytest .mark .slow
440436 @pytest .mark .parametrize (
441437 "nrows" , [2 , 10 , 99 , 100 , 101 , 102 , 198 , 199 , 200 , 201 , 202 , 249 , 250 , 251 ]
@@ -464,7 +460,7 @@ def test_to_csv_params(self, nrows, df_params, func_params, ncols):
464460 for _ in range (df_params ["c_idx_nlevels" ])
465461 )
466462 else :
467- columns = Index ([f"i-{ i } " for i in range (ncols )], dtype = object )
463+ columns = Index ([f"i-{ i } " for i in range (ncols )])
468464 df = DataFrame (np .ones ((nrows , ncols )), index = index , columns = columns )
469465 result , expected = self ._return_result_expected (df , 1000 , ** func_params )
470466 tm .assert_frame_equal (result , expected , check_names = False )
@@ -722,7 +718,6 @@ def test_to_csv_withcommas(self):
722718 df2 = self .read_csv (path )
723719 tm .assert_frame_equal (df2 , df )
724720
725- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
726721 def test_to_csv_mixed (self ):
727722 def create_cols (name ):
728723 return [f"{ name } { i :03d} " for i in range (5 )]
@@ -739,7 +734,7 @@ def create_cols(name):
739734 )
740735 df_bool = DataFrame (True , index = df_float .index , columns = create_cols ("bool" ))
741736 df_object = DataFrame (
742- "foo" , index = df_float .index , columns = create_cols ("object" )
737+ "foo" , index = df_float .index , columns = create_cols ("object" ), dtype = "object"
743738 )
744739 df_dt = DataFrame (
745740 Timestamp ("20010101" ).as_unit ("ns" ),
@@ -812,13 +807,12 @@ def test_to_csv_dups_cols(self):
812807 result .columns = df .columns
813808 tm .assert_frame_equal (result , df )
814809
815- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
816810 def test_to_csv_dups_cols2 (self ):
817811 # GH3457
818812 df = DataFrame (
819813 np .ones ((5 , 3 )),
820814 index = Index ([f"i-{ i } " for i in range (5 )], name = "foo" ),
821- columns = Index (["a" , "a" , "b" ], dtype = object ),
815+ columns = Index (["a" , "a" , "b" ]),
822816 )
823817
824818 with tm .ensure_clean () as filename :
0 commit comments