@@ -154,7 +154,6 @@ def test_bytesiowrapper_returns_correct_bytes(self):
154
154
assert result == data .encode ("utf-8" )
155
155
156
156
# Test that pyarrow can handle a file opened with get_handle
157
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
158
157
def test_get_handle_pyarrow_compat (self ):
159
158
pa_csv = pytest .importorskip ("pyarrow.csv" )
160
159
@@ -169,6 +168,8 @@ def test_get_handle_pyarrow_compat(self):
169
168
s = StringIO (data )
170
169
with icom .get_handle (s , "rb" , is_text = False ) as handles :
171
170
df = pa_csv .read_csv (handles .handle ).to_pandas ()
171
+ # TODO will have to update this when pyarrow' to_pandas() is fixed
172
+ expected = expected .astype ("object" )
172
173
tm .assert_frame_equal (df , expected )
173
174
assert not s .closed
174
175
@@ -352,7 +353,6 @@ def test_read_fspath_all(self, reader, module, path, datapath):
352
353
("to_stata" , {"time_stamp" : pd .to_datetime ("2019-01-01 00:00" )}, "os" ),
353
354
],
354
355
)
355
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
356
356
def test_write_fspath_all (self , writer_name , writer_kwargs , module ):
357
357
if writer_name in ["to_latex" ]: # uses Styler implementation
358
358
pytest .importorskip ("jinja2" )
@@ -379,7 +379,7 @@ def test_write_fspath_all(self, writer_name, writer_kwargs, module):
379
379
expected = f_path .read ()
380
380
assert result == expected
381
381
382
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
382
+ @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string) hdf support " )
383
383
def test_write_fspath_hdf5 (self ):
384
384
# Same test as write_fspath_all, except HDF5 files aren't
385
385
# necessarily byte-for-byte identical for a given dataframe, so we'll
@@ -450,14 +450,13 @@ def test_unknown_engine(self):
450
450
with tm .ensure_clean () as path :
451
451
df = pd .DataFrame (
452
452
1.1 * np .arange (120 ).reshape ((30 , 4 )),
453
- columns = pd .Index (list ("ABCD" ), dtype = object ),
454
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
453
+ columns = pd .Index (list ("ABCD" )),
454
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
455
455
)
456
456
df .to_csv (path )
457
457
with pytest .raises (ValueError , match = "Unknown engine" ):
458
458
pd .read_csv (path , engine = "pyt" )
459
459
460
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
461
460
def test_binary_mode (self ):
462
461
"""
463
462
'encoding' shouldn't be passed to 'open' in binary mode.
@@ -467,8 +466,8 @@ def test_binary_mode(self):
467
466
with tm .ensure_clean () as path :
468
467
df = pd .DataFrame (
469
468
1.1 * np .arange (120 ).reshape ((30 , 4 )),
470
- columns = pd .Index (list ("ABCD" ), dtype = object ),
471
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
469
+ columns = pd .Index (list ("ABCD" )),
470
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
472
471
)
473
472
df .to_csv (path , mode = "w+b" )
474
473
tm .assert_frame_equal (df , pd .read_csv (path , index_col = 0 ))
@@ -485,8 +484,8 @@ def test_warning_missing_utf_bom(self, encoding, compression_):
485
484
"""
486
485
df = pd .DataFrame (
487
486
1.1 * np .arange (120 ).reshape ((30 , 4 )),
488
- columns = pd .Index (list ("ABCD" ), dtype = object ),
489
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
487
+ columns = pd .Index (list ("ABCD" )),
488
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
490
489
)
491
490
with tm .ensure_clean () as path :
492
491
with tm .assert_produces_warning (UnicodeWarning ):
@@ -516,15 +515,14 @@ def test_is_fsspec_url():
516
515
assert icom .is_fsspec_url ("RFC-3986+compliant.spec://something" )
517
516
518
517
519
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
520
518
@pytest .mark .parametrize ("encoding" , [None , "utf-8" ])
521
519
@pytest .mark .parametrize ("format" , ["csv" , "json" ])
522
520
def test_codecs_encoding (encoding , format ):
523
521
# GH39247
524
522
expected = pd .DataFrame (
525
523
1.1 * np .arange (120 ).reshape ((30 , 4 )),
526
- columns = pd .Index (list ("ABCD" ), dtype = object ),
527
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
524
+ columns = pd .Index (list ("ABCD" )),
525
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
528
526
)
529
527
with tm .ensure_clean () as path :
530
528
with codecs .open (path , mode = "w" , encoding = encoding ) as handle :
@@ -537,13 +535,12 @@ def test_codecs_encoding(encoding, format):
537
535
tm .assert_frame_equal (expected , df )
538
536
539
537
540
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
541
538
def test_codecs_get_writer_reader ():
542
539
# GH39247
543
540
expected = pd .DataFrame (
544
541
1.1 * np .arange (120 ).reshape ((30 , 4 )),
545
- columns = pd .Index (list ("ABCD" ), dtype = object ),
546
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
542
+ columns = pd .Index (list ("ABCD" )),
543
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
547
544
)
548
545
with tm .ensure_clean () as path :
549
546
with open (path , "wb" ) as handle :
@@ -568,8 +565,8 @@ def test_explicit_encoding(io_class, mode, msg):
568
565
# wrong mode is requested
569
566
expected = pd .DataFrame (
570
567
1.1 * np .arange (120 ).reshape ((30 , 4 )),
571
- columns = pd .Index (list ("ABCD" ), dtype = object ),
572
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
568
+ columns = pd .Index (list ("ABCD" )),
569
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
573
570
)
574
571
with io_class () as buffer :
575
572
with pytest .raises (TypeError , match = msg ):
0 commit comments