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
@@ -422,20 +420,18 @@ def test_to_csv_empty(self):
422
420
result , expected = self ._return_result_expected (df , 1000 )
423
421
tm .assert_frame_equal (result , expected , check_column_type = False )
424
422
425
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
426
423
@pytest .mark .slow
427
424
def test_to_csv_chunksize (self ):
428
425
chunksize = 1000
429
426
rows = chunksize // 2 + 1
430
427
df = DataFrame (
431
428
np .ones ((rows , 2 )),
432
- columns = Index (list ("ab" ), dtype = object ),
429
+ columns = Index (list ("ab" )),
433
430
index = MultiIndex .from_arrays ([range (rows ) for _ in range (2 )]),
434
431
)
435
432
result , expected = self ._return_result_expected (df , chunksize , rnlvl = 2 )
436
433
tm .assert_frame_equal (result , expected , check_names = False )
437
434
438
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
439
435
@pytest .mark .slow
440
436
@pytest .mark .parametrize (
441
437
"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):
464
460
for _ in range (df_params ["c_idx_nlevels" ])
465
461
)
466
462
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 )])
468
464
df = DataFrame (np .ones ((nrows , ncols )), index = index , columns = columns )
469
465
result , expected = self ._return_result_expected (df , 1000 , ** func_params )
470
466
tm .assert_frame_equal (result , expected , check_names = False )
@@ -722,7 +718,6 @@ def test_to_csv_withcommas(self):
722
718
df2 = self .read_csv (path )
723
719
tm .assert_frame_equal (df2 , df )
724
720
725
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
726
721
def test_to_csv_mixed (self ):
727
722
def create_cols (name ):
728
723
return [f"{ name } { i :03d} " for i in range (5 )]
@@ -739,7 +734,7 @@ def create_cols(name):
739
734
)
740
735
df_bool = DataFrame (True , index = df_float .index , columns = create_cols ("bool" ))
741
736
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"
743
738
)
744
739
df_dt = DataFrame (
745
740
Timestamp ("20010101" ).as_unit ("ns" ),
@@ -812,13 +807,12 @@ def test_to_csv_dups_cols(self):
812
807
result .columns = df .columns
813
808
tm .assert_frame_equal (result , df )
814
809
815
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
816
810
def test_to_csv_dups_cols2 (self ):
817
811
# GH3457
818
812
df = DataFrame (
819
813
np .ones ((5 , 3 )),
820
814
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" ]),
822
816
)
823
817
824
818
with tm .ensure_clean () as filename :
0 commit comments