
    im                         d Z ddlmZ ddlmZ ddlZddlZddlmZmZm	Z	 ddl
mZ ej                  j                  d      Zej                  j!                  d      Zej                  j!                  d      Zej                  j'                  d	d
dg dd eg dg dg dg dg dg dg eg dd      g d      fdddgg dd eg dg dg dg dg dg e	j(                  g dddg      g d      fg      d        Zej                  j'                  dddgddgg      d        Zed        Zeej                  j'                  d d!d"d#gdgfd$ e	j(                  d%d&g      ddgfg      ej                  j'                  d'd(d)g      d*                      Zed+        Zd, Zed-        Zed.        Zed/        Zed0        Zed1        Zy)2zy
Tests that work on both the Python and C engines but do not have a
specific classification into the other test modules.
    )datetime)StringION)	DataFrameIndex
MultiIndexz=ignore:Passing a BlockManager to DataFrame:DeprecationWarningpyarrow_xfailpyarrow_skipzdata,kwargs,expectedz[foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
qux,12,13,14,15
foo2,12,13,14,15
bar2,12,13,14,15
)indexABCD)	index_colnames                  	   
               )foobarbazquxfoo2bar2r
   namer   r   r   r   )r
   columnsz_foo,one,2,3,4,5
foo,two,7,8,9,10
foo,three,12,13,14,15
bar,one,12,13,14,15
bar,two,12,13,14,15
   )index1index2r   r   r   r   )r    one)r    two)r    three)r!   r.   )r!   r/   r+   r,   r   c                 l    | } |j                   t        |      fi |}t        j                  ||       y )N)read_csvr   tmassert_frame_equal)all_parsersdatakwargsexpectedparserresults         e/app/cer_product_mecsu/.venv/lib/python3.12/site-packages/pandas/tests/io/parser/common/test_index.pytest_pass_names_with_indexr=      s3    r FV__Xd^6v6F&(+    r   c                 $   d}dj                  |j                  d      dd        }g d}|}|j                  t        |      |d |      }|j                  t        |      |      }	d gdz  |	j                  _        t        j                  ||	       y )Nzuindex1,index2,A,B,C,D
foo,one,2,3,4,5
foo,two,7,8,9,10
foo,three,12,13,14,15
bar,one,12,13,14,15
bar,two,12,13,14,15

r*   r(   )r   headerr   r   r   )joinsplitr3   r   r
   r   r4   r5   )
requestr6   r   using_infer_stringr7   headless_datar   r:   r;   r9   s
             r<   test_multi_index_no_level_namesrH   Y   s    D IIdjj.qr23M EF__9T  F x~CH !6A:HNN&(+r>   c                     | }d}|j                  t        |            }t        g dg dg dg dg dgg dt        j                  g d            }t        j                  ||       y )NzgA,B,C,D
foo,one,2,3,4,5
foo,two,7,8,9,10
foo,three,12,13,14,15
bar,one,12,13,14,15
bar,two,12,13,14,15
r   r   r   r(   r-   r)   r
   )r3   r   r   r   from_tuplesr4   r5   r6   r:   r7   r;   r9   s        r<   (test_multi_index_no_level_names_implicitrM   s   sj    FD __Xd^,F	
 %$$
H& &(+r>   zdata,columns,headerza,babza,b
c,d)rN   c)rO   d
round_tripTFc                     | }t        |      }|r|j                  d      n|}|j                  t        |      |      }t	        j
                  ||       y )Nr)   F)r
   )rA   )r   to_csvr3   r   r4   r5   )r6   r7   r)   rA   rR   r:   r9   r;   s           r<   test_multi_index_blank_dfrV      sM     F)H+58???'4D__Xd^F_;F&(+r>   c                     | }d}|j                  t        |      d      }t        g dg dg dgg d      }t        j                  ||       y )	Nz+ id c0 c1 c2
0 1 0 a b
1 2 0 c d
2 2 2 e f
 )sep)r   r*   r   rN   rO   )r*   r   r   rP   rQ   )r   r   r   ef)z
Unnamed: 0idc0c1c2rT   )r3   r   r   r4   r5   rL   s        r<   test_no_unnamed_indexr`      sQ    FD
 __Xd^_5F	13FG6H &(+r>   c           	          d}| }|j                  t        |      d      }t        g dg dg dg dg dg dgg dt        g dd	
            }t	        j
                  ||       y )Nzgindex,A,B,C,D
foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
qux,12,13,14,15
foo,12,13,14,15
bar,12,13,14,15
r   rB   r   r   r   r(   r    r!   r"   r#   r    r!   r
   r&   rJ   r3   r   r   r   r4   r5   r6   r7   r:   r;   r9   s        r<   "test_read_duplicate_index_explicitre      si    D F__Xd^q_9F	
 %>WMH &(+r>   c           	          d}| }|j                  t        |            }t        g dg dg dg dg dg dgg dt        g d            }t	        j
                  ||       y )NzaA,B,C,D
foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
qux,12,13,14,15
foo,12,13,14,15
bar,12,13,14,15
r   r   r   r(   rb   rJ   rc   rd   s        r<   "test_read_duplicate_index_implicitrg      sc    D F__Xd^,F	
 %>?H &(+r>   c                 h   | }t         j                  j                  |d      }|j                  |dd      }t	        g dg dg dg dg d	gg d
t        t        ddd      t        ddd      t        ddd      t        ddd      t        ddd      gd            }t        j                  ||       y )Nz	test2.csvr   T)r   parse_dates)gA	]^?gֈ`|@g% TO׿gnIr    )g=HOC?gW\g~q"BĿg=4?r!   )gZH?g7ne?g>ݦ4g_YiR?r"   )g䞮X?gt]?gnk3Am?g-?r#   )gP,߿g~W[I?gN6gFgZ&|?r$   )r   r   r   r   Ei  r*   r   r   r      r   zM8[us])dtyperJ   )	ospathrC   r3   r   r   r   r4   r5   )r6   csv_dir_pathr:   csv2r;   r9   s         r<   test_read_csv_no_index_namerq      s    F77<<k2D__TQD_AFCBBCB	
 *q!$q!$q!$q!$q!$ 	
H( &(+r>   c                     d}| }|j                  t        |      d      }t        dgt        g d            }t	        j
                  ||       y )Nzx,yr   rB   yxr&   rJ   rc   rd   s        r<   test_empty_with_indexru     sI     DF__Xd^q_9F#eBS.ABH&(+r>   c                     d}| }|j                  t        |      ddg      }t        dgt        j                  g gdz  ddg            }t        j                  ||       y )	Nx,y,zrt   rs   rB   zr   r1   rJ   r3   r   r   r   from_arraysr4   r5   rd   s        r<   test_empty_with_multi_indexr{     sb     DF__Xd^Sz_BFZ33RD1HS#JOH &(+r>   c                     d}| }|j                  t        |      ddg      }t        dgt        j                  g gdz  ddg	      
      }t        j                  ||       y )Nrw   r*   r   rB   rx   r   rs   rt   r1   rJ   ry   rd   s        r<   $test_empty_with_reversed_multi_indexr}   *  s`    DF__Xd^1v_>FZ33RD1HS#JOH &(+r>   ) __doc__r   ior   rm   pytestpandasr   r   r   pandas._testing_testingr4   markfilterwarnings
pytestmarkusefixturesxfail_pyarrowskip_pyarrowparametrizerK   r=   rH   rM   rV   r`   re   rg   rq   ru   r{   r}    r>   r<   <module>r      s  
   	  
 [[''C
 ''8{{&&~6  &CD !$$$$ HwW,	
. a&+ST !$$$ -j,, $X.	 -%	
/47p,q7p, 1v1v&67, 8,2 , ,B 	c
QC "J""J
#;<F	

 e}5, 6
 , , ,,6 , ,6 , ,8 , , 	, 	, , ,r>   