a
    Pf*                      @   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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d0d1 Zd2d3 Zed4d5 Zed6d7 Zed8d9 Zed:d; 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=ignore:Passing a BlockManager to DataFrame:DeprecationWarningZ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   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 r7   a/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/tests/io/parser/common/test_index.pytest_pass_names_with_index   s    9r9   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/   r0   )r1   r   r2   Zheadless_datar   r5   r6   r4   r7   r7   r8   test_multi_index_no_level_namesX   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/   r0   r1   r5   r2   r6   r4   r7   r7   r8   (test_multi_index_no_level_names_implicitp   s     rC   zdata,expected,headerza,babr%   za,b
c,d)rD   c)rE   d
round_tripTFc                 C   s:   | }|r|j ddn|}|jt||d}t|| d S )NF)r   )r;   )Zto_csvr.   r   r/   r0   )r1   r2   r4   r;   rI   r5   r6   r7   r7   r8   test_multi_index_blank_df   s    rJ   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   rD   rE   )r&   r   r   rG   rH   )r   r   r   ef)z
Unnamed: 0idZc0c1c2rF   )r.   r   r   r/   r0   rB   r7   r7   r8   test_no_unnamed_index   s    rR   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/   r0   r1   r2   r5   r6   r4   r7   r7   r8   "test_read_duplicate_index_explicit   s    rV   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$   rS   r@   rT   rU   r7   r7   r8   "test_read_duplicate_index_implicit   s    
rW   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/   r0   )r1   Zcsv_dir_pathr5   Zcsv2r6   r4   r7   r7   r8   test_read_csv_no_index_name   s*    




r\   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@   rT   rU   r7   r7   r8   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^   r]   r<   zr   r-   r@   r.   r   r   r   Zfrom_arraysr/   r0   rU   r7   r7   r8   test_empty_with_multi_index  s    rc   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<   ra   r   r]   r^   r-   r@   rb   rU   r7   r7   r8   $test_empty_with_reversed_multi_index%  s    rd   ) __doc__r   ior   rZ   ZpytestZpandasr   r   r   Zpandas._testingZ_testingr/   markfilterwarningsZ
pytestmarkZusefixturesZxfail_pyarrowZskip_pyarrowZparametrizerA   r9   r?   rC   rJ   rR   rV   rW   r\   r_   rc   rd   r7   r7   r7   r8   <module>   s   
8


!	




