a
    Gb^                     @   s  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dZejdZe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dg d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dg ddfgdd Zejdddgddggdd Zed d! Zeejd"d#ed$d%gd&dgfd'ee	d(d)gd&ddgfgejd*d+d,gd-d. Zed/d0 Zd1d2 Zed3d4 Zed5d6 Zed7d8 Zed9d: Zed;d< ZdS )=zy
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pyarrow_xfailZ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foo2Z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   Zthree)r   r*   )r   r+   r'   r(   r   c                 C   s*   | }|j t|fi |}t|| d S )N)read_csvr   tmassert_frame_equal)all_parsersdatakwargsexpectedparserresult r6   Glib/python3.9/site-packages/pandas/tests/io/parser/common/test_index.pytest_pass_names_with_index   s    9r8   r   c                 C   sn   d}d |ddd  }g d}| }|jt||d |d}|jt||d}d gd |j_t|| d S )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splitr-   r   r   r   r.   r/   )r0   r   r1   Zheadless_datar   r4   r5   r3   r6   r6   r7   test_multi_index_no_level_namesW   s    r>   c                 C   s`   | }d}| t|}tg dg dg dg dg dgg dtg dd}t|| d S )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   )r-   r   r   r   from_tuplesr.   r/   r0   r4   r1   r5   r3   r6   r6   r7   (test_multi_index_no_level_names_implicito   s     rB   zdata,expected,headerza,babr%   za,b
c,d)rC   c)rD   d
round_tripTFc                 C   s:   | }|r|j ddn|}|jt||d}t|| d S )NF)r   )r:   )Zto_csvr-   r   r.   r/   )r0   r1   r3   r:   rH   r4   r5   r6   r6   r7   test_multi_index_blank_df   s    rI   c                 C   sL   | }d}|j t|dd}tg dg dg dgg dd}t|| d S )	Nz+ id c0 c1 c2
0 1 0 a b
1 2 0 c d
2 2 2 e f
 )sep)r   r&   r   rC   rD   )r&   r   r   rF   rG   )r   r   r   ef)z
Unnamed: 0idZc0Zc1Zc2rE   )r-   r   r   r.   r/   rA   r6   r6   r7   test_no_unnamed_index   s    rO   c                 C   sl   d}| }|j t|dd}tg dg dg dg dg dg dgg dtg dd	d
d}t|| d S )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   r;   r   r   r   r$   r   r   r   r    r   r   r   r"   r?   r-   r   r   r   r.   r/   r0   r1   r4   r5   r3   r6   r6   r7   "test_read_duplicate_index_explicit   s    rS   c                 C   sd   d}| }| t|}tg dg dg dg dg dg dgg dtg dd}t|| d S )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$   rP   r?   rQ   rR   r6   r6   r7   "test_read_duplicate_index_implicit   s    
rT   c                 C   s   | }t j|d}|j|d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|| d S )Nz	test2.csvr   T)r   Z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   r?   )	ospathr<   r-   r   r   r   r.   r/   )r0   Zcsv_dir_pathr4   Zcsv2r5   r3   r6   r6   r7   test_read_csv_no_index_name   s*    




rY   c                 C   s@   d}| }|j t|dd}tdgtg ddd}t|| d S )Nzx,yr   r;   yxr"   r?   rQ   rR   r6   r6   r7   test_empty_with_index
  s
    r\   c                 C   sP   d}| }|j t|ddgd}tdgtjg gd ddgdd}t|| d S )	Nx,y,zr[   rZ   r;   zr   r,   r?   r-   r   r   r   Zfrom_arraysr.   r/   rR   r6   r6   r7   test_empty_with_multi_index  s    r`   c                 C   sP   d}| }|j t|ddgd}tdgtjg gd ddgd	d
}t|| d S )Nr]   r&   r   r;   r^   r   rZ   r[   r,   r?   r_   rR   r6   r6   r7   $test_empty_with_reversed_multi_index"  s    ra   )__doc__r   ior   rW   ZpytestZpandasr   r   r   Zpandas._testingZ_testingr.   ZmarkZusefixturesZxfail_pyarrowZskip_pyarrowZparametrizer@   r8   r>   rB   rI   rO   rS   rT   rY   r\   r`   ra   r6   r6   r6   r7   <module>   s   
8


!	





