o
    ŀg*                      @   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: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                 C   s*   | }|j t|fi |}t|| d S )N)read_csvr   tmassert_frame_equal)all_parsersdatakwargsexpectedparserresult r:   \/var/www/html/myenv/lib/python3.10/site-packages/pandas/tests/io/parser/common/test_index.pytest_pass_names_with_index   s   9r<   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splitr1   r   r	   r   r2   r3   )r4   r   r5   headless_datar   r8   r9   r7   r:   r:   r;   test_multi_index_no_level_namesX   s   rC   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	   )r1   r   r   r   from_tuplesr2   r3   r4   r8   r5   r9   r7   r:   r:   r;   (test_multi_index_no_level_names_implicitp   s    rG   zdata,expected,headerza,babr(   za,b
c,d)rH   c)rI   d
round_tripTFc                 C   s:   | }|r
|j ddn|}|jt||d}t|| d S )NF)r	   )r>   )to_csvr1   r   r2   r3   )r4   r5   r7   r>   rM   r8   r9   r:   r:   r;   test_multi_index_blank_df   s   rO   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   rH   rI   )r)   r   r   rK   rL   )r   r   r   ef)z
Unnamed: 0idc0c1c2rJ   )r1   r   r   r2   r3   rF   r:   r:   r;   test_no_unnamed_index   s   rX   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%   rD   r1   r   r   r   r2   r3   r4   r5   r8   r9   r7   r:   r:   r;   "test_read_duplicate_index_explicit   s   r\   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'   rY   rD   rZ   r[   r:   r:   r;   "test_read_duplicate_index_implicit   s   
r]   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   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   rD   )	ospathr@   r1   r   r   r   r2   r3   )r4   csv_dir_pathr8   csv2r9   r7   r:   r:   r;   test_read_csv_no_index_name   s*   




re   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%   rD   rZ   r[   r:   r:   r;   test_empty_with_index  s
   rh   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,zrg   rf   r?   zr   r0   rD   r1   r   r   r   from_arraysr2   r3   r[   r:   r:   r;   test_empty_with_multi_index  s   rm   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 )Nri   r)   r   r?   rj   r   rf   rg   r0   rD   rk   r[   r:   r:   r;   $test_empty_with_reversed_multi_index%  s   rn   ) __doc__r   ior   ra   pytestpandasr   r   r   pandas._testing_testingr2   markfilterwarnings
pytestmarkusefixturesxfail_pyarrowskip_pyarrowparametrizerE   r<   rC   rG   rO   rX   r\   r]   re   rh   rm   rn   r:   r:   r:   r;   <module>   s    

8

!	




