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
@@ -438,20 +436,18 @@ def test_to_csv_empty(self):
438436 result , expected = self ._return_result_expected (df , 1000 )
439437 tm .assert_frame_equal (result , expected , check_column_type = False )
440438
441- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
442439 @pytest .mark .slow
443440 def test_to_csv_chunksize (self ):
444441 chunksize = 1000
445442 rows = chunksize // 2 + 1
446443 df = DataFrame (
447444 np .ones ((rows , 2 )),
448- columns = Index (list ("ab" ), dtype = object ),
445+ columns = Index (list ("ab" )),
449446 index = MultiIndex .from_arrays ([range (rows ) for _ in range (2 )]),
450447 )
451448 result , expected = self ._return_result_expected (df , chunksize , rnlvl = 2 )
452449 tm .assert_frame_equal (result , expected , check_names = False )
453450
454- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
455451 @pytest .mark .slow
456452 @pytest .mark .parametrize (
457453 "nrows" , [2 , 10 , 99 , 100 , 101 , 102 , 198 , 199 , 200 , 201 , 202 , 249 , 250 , 251 ]
@@ -480,7 +476,7 @@ def test_to_csv_params(self, nrows, df_params, func_params, ncols):
480476 for _ in range (df_params ["c_idx_nlevels" ])
481477 )
482478 else :
483- columns = Index ([f"i-{ i } " for i in range (ncols )], dtype = object )
479+ columns = Index ([f"i-{ i } " for i in range (ncols )])
484480 df = DataFrame (np .ones ((nrows , ncols )), index = index , columns = columns )
485481 result , expected = self ._return_result_expected (df , 1000 , ** func_params )
486482 tm .assert_frame_equal (result , expected , check_names = False )
@@ -738,7 +734,6 @@ def test_to_csv_withcommas(self, temp_file):
738734 df2 = self .read_csv (path )
739735 tm .assert_frame_equal (df2 , df )
740736
741- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
742737 def test_to_csv_mixed (self , temp_file ):
743738 def create_cols (name ):
744739 return [f"{ name } { i :03d} " for i in range (5 )]
@@ -755,7 +750,7 @@ def create_cols(name):
755750 )
756751 df_bool = DataFrame (True , index = df_float .index , columns = create_cols ("bool" ))
757752 df_object = DataFrame (
758- "foo" , index = df_float .index , columns = create_cols ("object" )
753+ "foo" , index = df_float .index , columns = create_cols ("object" ), dtype = "object"
759754 )
760755 df_dt = DataFrame (
761756 Timestamp ("20010101" ),
@@ -824,13 +819,12 @@ def test_to_csv_dups_cols(self, temp_file):
824819 result .columns = df .columns
825820 tm .assert_frame_equal (result , df )
826821
827- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
828822 def test_to_csv_dups_cols2 (self , temp_file ):
829823 # GH3457
830824 df = DataFrame (
831825 np .ones ((5 , 3 )),
832826 index = Index ([f"i-{ i } " for i in range (5 )], name = "foo" ),
833- columns = Index (["a" , "a" , "b" ], dtype = object ),
827+ columns = Index (["a" , "a" , "b" ]),
834828 )
835829
836830 path = str (temp_file )
0 commit comments