88import  numpy  as  np 
99import  pytest 
1010
11- from  pandas ._config  import  using_copy_on_write 
12- 
1311from  pandas .compat  import  is_platform_windows 
1412from  pandas .compat .pyarrow  import  (
1513 pa_version_under11p0 ,
@@ -425,15 +423,10 @@ def test_read_filters(self, engine, tmp_path):
425423 repeat = 1 ,
426424 )
427425
428-  def  test_write_index (self , engine , using_copy_on_write , request ):
429-  check_names  =  engine  !=  "fastparquet" 
430-  if  using_copy_on_write  and  engine  ==  "fastparquet" :
431-  request .applymarker (
432-  pytest .mark .xfail (reason = "fastparquet write into index" )
433-  )
434- 
426+  def  test_write_index (self ):
427+  pytest .importorskip ("pyarrow" )
435428 df  =  pd .DataFrame ({"A" : [1 , 2 , 3 ]})
436-  check_round_trip (df , engine )
429+  check_round_trip (df , "pyarrow" )
437430
438431 indexes  =  [
439432 [2 , 3 , 4 ],
@@ -446,12 +439,12 @@ def test_write_index(self, engine, using_copy_on_write, request):
446439 df .index  =  index 
447440 if  isinstance (index , pd .DatetimeIndex ):
448441 df .index  =  df .index ._with_freq (None ) # freq doesn't round-trip 
449-  check_round_trip (df , engine ,  check_names = check_names )
442+  check_round_trip (df , "pyarrow" )
450443
451444 # index with meta-data 
452445 df .index  =  [0 , 1 , 2 ]
453446 df .index .name  =  "foo" 
454-  check_round_trip (df , engine )
447+  check_round_trip (df , "pyarrow" )
455448
456449 def  test_write_multiindex (self , pa ):
457450 # Not supported in fastparquet as of 0.1.3 or older pyarrow version 
@@ -1256,23 +1249,6 @@ def test_error_on_using_partition_cols_and_partition_on(
12561249 partition_cols = partition_cols ,
12571250 )
12581251
1259-  @pytest .mark .skipif (using_copy_on_write (), reason = "fastparquet writes into Index" ) 
1260-  def  test_empty_dataframe (self , fp ):
1261-  # GH #27339 
1262-  df  =  pd .DataFrame ()
1263-  expected  =  df .copy ()
1264-  check_round_trip (df , fp , expected = expected )
1265- 
1266-  @pytest .mark .skipif (using_copy_on_write (), reason = "fastparquet writes into Index" ) 
1267-  def  test_timezone_aware_index (self , fp , timezone_aware_date_list ):
1268-  idx  =  5  *  [timezone_aware_date_list ]
1269- 
1270-  df  =  pd .DataFrame (index = idx , data = {"index_as_col" : idx })
1271- 
1272-  expected  =  df .copy ()
1273-  expected .index .name  =  "index" 
1274-  check_round_trip (df , fp , expected = expected )
1275- 
12761252 def  test_close_file_handle_on_read_error (self ):
12771253 with  tm .ensure_clean ("test.parquet" ) as  path :
12781254 pathlib .Path (path ).write_bytes (b"breakit" )
@@ -1361,10 +1337,3 @@ def test_invalid_dtype_backend(self, engine):
13611337 df .to_parquet (path )
13621338 with  pytest .raises (ValueError , match = msg ):
13631339 read_parquet (path , dtype_backend = "numpy" )
1364- 
1365-  @pytest .mark .skipif (using_copy_on_write (), reason = "fastparquet writes into Index" ) 
1366-  def  test_empty_columns (self , fp ):
1367-  # GH 52034 
1368-  df  =  pd .DataFrame (index = pd .Index (["a" , "b" , "c" ], name = "custom name" ))
1369-  expected  =  pd .DataFrame (index = pd .Index (["a" , "b" , "c" ], name = "custom name" ))
1370-  check_round_trip (df , fp , expected = expected )
0 commit comments