5
5
import numpy as np
6
6
import pytest
7
7
8
- from pandas ._config import using_string_dtype
9
-
10
8
from pandas .errors import ParserError
11
9
12
10
import pandas as pd
@@ -438,20 +436,18 @@ def test_to_csv_empty(self):
438
436
result , expected = self ._return_result_expected (df , 1000 )
439
437
tm .assert_frame_equal (result , expected , check_column_type = False )
440
438
441
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
442
439
@pytest .mark .slow
443
440
def test_to_csv_chunksize (self ):
444
441
chunksize = 1000
445
442
rows = chunksize // 2 + 1
446
443
df = DataFrame (
447
444
np .ones ((rows , 2 )),
448
- columns = Index (list ("ab" ), dtype = object ),
445
+ columns = Index (list ("ab" )),
449
446
index = MultiIndex .from_arrays ([range (rows ) for _ in range (2 )]),
450
447
)
451
448
result , expected = self ._return_result_expected (df , chunksize , rnlvl = 2 )
452
449
tm .assert_frame_equal (result , expected , check_names = False )
453
450
454
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
455
451
@pytest .mark .slow
456
452
@pytest .mark .parametrize (
457
453
"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):
480
476
for _ in range (df_params ["c_idx_nlevels" ])
481
477
)
482
478
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 )])
484
480
df = DataFrame (np .ones ((nrows , ncols )), index = index , columns = columns )
485
481
result , expected = self ._return_result_expected (df , 1000 , ** func_params )
486
482
tm .assert_frame_equal (result , expected , check_names = False )
@@ -738,7 +734,6 @@ def test_to_csv_withcommas(self, temp_file):
738
734
df2 = self .read_csv (path )
739
735
tm .assert_frame_equal (df2 , df )
740
736
741
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
742
737
def test_to_csv_mixed (self , temp_file ):
743
738
def create_cols (name ):
744
739
return [f"{ name } { i :03d} " for i in range (5 )]
@@ -755,7 +750,7 @@ def create_cols(name):
755
750
)
756
751
df_bool = DataFrame (True , index = df_float .index , columns = create_cols ("bool" ))
757
752
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"
759
754
)
760
755
df_dt = DataFrame (
761
756
Timestamp ("20010101" ),
@@ -824,13 +819,12 @@ def test_to_csv_dups_cols(self, temp_file):
824
819
result .columns = df .columns
825
820
tm .assert_frame_equal (result , df )
826
821
827
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
828
822
def test_to_csv_dups_cols2 (self , temp_file ):
829
823
# GH3457
830
824
df = DataFrame (
831
825
np .ones ((5 , 3 )),
832
826
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" ]),
834
828
)
835
829
836
830
path = str (temp_file )
0 commit comments