23
23
"ignore:Passing a BlockManager to DataFrame:DeprecationWarning"
24
24
)
25
25
26
- xfail_pyarrow = pytest .mark .usefixtures ("pyarrow_xfail" )
27
26
skip_pyarrow = pytest .mark .usefixtures ("pyarrow_skip" )
28
27
29
28
@@ -238,7 +237,6 @@ def test_parse_encoded_special_characters(encoding):
238
237
tm .assert_frame_equal (result , expected )
239
238
240
239
241
- @xfail_pyarrow # ValueError: The 'memory_map' option is not supported
242
240
@pytest .mark .parametrize ("encoding" , ["utf-8" , None , "utf-16" , "cp1255" , "latin-1" ])
243
241
def test_encoding_memory_map (all_parsers , encoding ):
244
242
# GH40986
@@ -252,11 +250,17 @@ def test_encoding_memory_map(all_parsers, encoding):
252
250
)
253
251
with tm .ensure_clean () as file :
254
252
expected .to_csv (file , index = False , encoding = encoding )
253
+
254
+ if parser .engine == "pyarrow" :
255
+ msg = "The 'memory_map' option is not supported with the 'pyarrow' engine"
256
+ with pytest .raises (ValueError , match = msg ):
257
+ parser .read_csv (file , encoding = encoding , memory_map = True )
258
+ return
259
+
255
260
df = parser .read_csv (file , encoding = encoding , memory_map = True )
256
261
tm .assert_frame_equal (df , expected )
257
262
258
263
259
- @xfail_pyarrow # ValueError: The 'memory_map' option is not supported
260
264
def test_chunk_splits_multibyte_char (all_parsers ):
261
265
"""
262
266
Chunk splits a multibyte character with memory_map=True
@@ -272,11 +276,17 @@ def test_chunk_splits_multibyte_char(all_parsers):
272
276
df .iloc [2047 ] = "a" * 127 + "ą"
273
277
with tm .ensure_clean ("bug-gh43540.csv" ) as fname :
274
278
df .to_csv (fname , index = False , header = False , encoding = "utf-8" )
275
- dfr = parser .read_csv (fname , header = None , memory_map = True , engine = "c" )
279
+
280
+ if parser .engine == "pyarrow" :
281
+ msg = "The 'memory_map' option is not supported with the 'pyarrow' engine"
282
+ with pytest .raises (ValueError , match = msg ):
283
+ parser .read_csv (fname , header = None , memory_map = True )
284
+ return
285
+
286
+ dfr = parser .read_csv (fname , header = None , memory_map = True )
276
287
tm .assert_frame_equal (dfr , df )
277
288
278
289
279
- @xfail_pyarrow # ValueError: The 'memory_map' option is not supported
280
290
def test_readcsv_memmap_utf8 (all_parsers ):
281
291
"""
282
292
GH 43787
@@ -300,9 +310,14 @@ def test_readcsv_memmap_utf8(all_parsers):
300
310
df = DataFrame (lines )
301
311
with tm .ensure_clean ("utf8test.csv" ) as fname :
302
312
df .to_csv (fname , index = False , header = False , encoding = "utf-8" )
303
- dfr = parser .read_csv (
304
- fname , header = None , memory_map = True , engine = "c" , encoding = "utf-8"
305
- )
313
+
314
+ if parser .engine == "pyarrow" :
315
+ msg = "The 'memory_map' option is not supported with the 'pyarrow' engine"
316
+ with pytest .raises (ValueError , match = msg ):
317
+ parser .read_csv (fname , header = None , memory_map = True , encoding = "utf-8" )
318
+ return
319
+
320
+ dfr = parser .read_csv (fname , header = None , memory_map = True , encoding = "utf-8" )
306
321
tm .assert_frame_equal (df , dfr )
307
322
308
323
0 commit comments