@@ -140,7 +140,6 @@ def test_bytesiowrapper_returns_correct_bytes(self):
140
140
assert result == data .encode ("utf-8" )
141
141
142
142
# Test that pyarrow can handle a file opened with get_handle
143
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
144
143
def test_get_handle_pyarrow_compat (self ):
145
144
pa_csv = pytest .importorskip ("pyarrow.csv" )
146
145
@@ -155,6 +154,8 @@ def test_get_handle_pyarrow_compat(self):
155
154
s = StringIO (data )
156
155
with icom .get_handle (s , "rb" , is_text = False ) as handles :
157
156
df = pa_csv .read_csv (handles .handle ).to_pandas ()
157
+ # TODO will have to update this when pyarrow' to_pandas() is fixed
158
+ expected = expected .astype ("object" )
158
159
tm .assert_frame_equal (df , expected )
159
160
assert not s .closed
160
161
@@ -338,7 +339,6 @@ def test_read_fspath_all(self, reader, module, path, datapath):
338
339
("to_stata" , {"time_stamp" : pd .to_datetime ("2019-01-01 00:00" )}, "os" ),
339
340
],
340
341
)
341
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
342
342
def test_write_fspath_all (self , writer_name , writer_kwargs , module ):
343
343
if writer_name in ["to_latex" ]: # uses Styler implementation
344
344
pytest .importorskip ("jinja2" )
@@ -365,7 +365,7 @@ def test_write_fspath_all(self, writer_name, writer_kwargs, module):
365
365
expected = f_path .read ()
366
366
assert result == expected
367
367
368
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
368
+ @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string) hdf support " )
369
369
def test_write_fspath_hdf5 (self ):
370
370
# Same test as write_fspath_all, except HDF5 files aren't
371
371
# necessarily byte-for-byte identical for a given dataframe, so we'll
@@ -438,14 +438,13 @@ def test_unknown_engine(self):
438
438
with tm .ensure_clean () as path :
439
439
df = pd .DataFrame (
440
440
1.1 * np .arange (120 ).reshape ((30 , 4 )),
441
- columns = pd .Index (list ("ABCD" ), dtype = object ),
442
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
441
+ columns = pd .Index (list ("ABCD" )),
442
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
443
443
)
444
444
df .to_csv (path )
445
445
with pytest .raises (ValueError , match = "Unknown engine" ):
446
446
pd .read_csv (path , engine = "pyt" )
447
447
448
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
449
448
def test_binary_mode (self ):
450
449
"""
451
450
'encoding' shouldn't be passed to 'open' in binary mode.
@@ -455,8 +454,8 @@ def test_binary_mode(self):
455
454
with tm .ensure_clean () as path :
456
455
df = pd .DataFrame (
457
456
1.1 * np .arange (120 ).reshape ((30 , 4 )),
458
- columns = pd .Index (list ("ABCD" ), dtype = object ),
459
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
457
+ columns = pd .Index (list ("ABCD" )),
458
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
460
459
)
461
460
df .to_csv (path , mode = "w+b" )
462
461
tm .assert_frame_equal (df , pd .read_csv (path , index_col = 0 ))
@@ -473,8 +472,8 @@ def test_warning_missing_utf_bom(self, encoding, compression_):
473
472
"""
474
473
df = pd .DataFrame (
475
474
1.1 * np .arange (120 ).reshape ((30 , 4 )),
476
- columns = pd .Index (list ("ABCD" ), dtype = object ),
477
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
475
+ columns = pd .Index (list ("ABCD" )),
476
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
478
477
)
479
478
with tm .ensure_clean () as path :
480
479
with tm .assert_produces_warning (UnicodeWarning , match = "byte order mark" ):
@@ -504,15 +503,14 @@ def test_is_fsspec_url():
504
503
assert icom .is_fsspec_url ("RFC-3986+compliant.spec://something" )
505
504
506
505
507
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
508
506
@pytest .mark .parametrize ("encoding" , [None , "utf-8" ])
509
507
@pytest .mark .parametrize ("format" , ["csv" , "json" ])
510
508
def test_codecs_encoding (encoding , format ):
511
509
# GH39247
512
510
expected = pd .DataFrame (
513
511
1.1 * np .arange (120 ).reshape ((30 , 4 )),
514
- columns = pd .Index (list ("ABCD" ), dtype = object ),
515
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
512
+ columns = pd .Index (list ("ABCD" )),
513
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
516
514
)
517
515
with tm .ensure_clean () as path :
518
516
with codecs .open (path , mode = "w" , encoding = encoding ) as handle :
@@ -525,13 +523,12 @@ def test_codecs_encoding(encoding, format):
525
523
tm .assert_frame_equal (expected , df )
526
524
527
525
528
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
529
526
def test_codecs_get_writer_reader ():
530
527
# GH39247
531
528
expected = pd .DataFrame (
532
529
1.1 * np .arange (120 ).reshape ((30 , 4 )),
533
- columns = pd .Index (list ("ABCD" ), dtype = object ),
534
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
530
+ columns = pd .Index (list ("ABCD" )),
531
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
535
532
)
536
533
with tm .ensure_clean () as path :
537
534
with open (path , "wb" ) as handle :
@@ -556,8 +553,8 @@ def test_explicit_encoding(io_class, mode, msg):
556
553
# wrong mode is requested
557
554
expected = pd .DataFrame (
558
555
1.1 * np .arange (120 ).reshape ((30 , 4 )),
559
- columns = pd .Index (list ("ABCD" ), dtype = object ),
560
- index = pd .Index ([f"i-{ i } " for i in range (30 )], dtype = object ),
556
+ columns = pd .Index (list ("ABCD" )),
557
+ index = pd .Index ([f"i-{ i } " for i in range (30 )]),
561
558
)
562
559
with io_class () as buffer :
563
560
with pytest .raises (TypeError , match = msg ):
0 commit comments