o
    ŀgK                     @   s8  d Z ddlmZ ddlZddlZddlmZmZ ddl	m
Z ejdZejdZejdZdd	 Zejd
di eddgddgddggddgdfdg dg ddeddgddgddgddgddggddgdfdi eddgddgddggddgdfddgdgdeddgddggddgdfgdd Zdd Zejd d!d"gd#d$ Zd%d& Zejd'dejejgd(d) Zeejd*eejjeejjeejjgd+d, Zeejd*eejjd eejjd gd-d. Zeejd/e d0e d1ge d1e d0ggd2d3 Z!d4d5 Z"dS )6zy
Tests that work on both the Python and C engines but do not have a
specific classification into the other test modules.
    )StringION)	DataFrameSeriesz=ignore:Passing a BlockManager to DataFrame:DeprecationWarningpyarrow_xfailpyarrow_skipc                 C   sH   d}| }| t|}tddgddgddggdd	gd
}t|| d S )NzA,B
1.0,1
2.0,2
3.0,3
g      ?   g       @   g      @   ABcolumnsread_csvr   r   tmassert_frame_equalall_parsersdataparserresultexpected r   [/var/www/html/myenv/lib/python3.10/site-packages/pandas/tests/io/parser/common/test_ints.pytest_int_conversion   s
   "r   zdata,kwargs,expectedzA,B
True,1
False,2
True,3Tr   Fr   r	   r
   r   r   zA,B
YES,1
no,2
yes,3
No,3
Yes,3)yesYesYES)noNONo)true_valuesfalse_valueszA,B
TRUE,1
FALSE,2
TRUE,3zA,B
foo,bar
bar,foofoobarc                 C   s*   | }|j t|fi |}t|| d S )N)r   r   r   r   )r   r   kwargsr   r   r   r   r   r   test_parse_bool%   s   r&   c                 C   s6   d}| }| t|}tdg di}t|| d S )NzNumbers
17007000002000191
17007000002000191
17007000002000191
17007000002000191
17007000002000192
17007000002000192
17007000002000192
17007000002000192
17007000002000192
17007000002000194Numbers)
   ?u/r(   r(   r(      @u/r)   r)   r)   r)   l   Bu/r   r   r   r   r   &test_parse_integers_above_fp_precisionG   s   r*   sep z\s+c                 C   s   d}| }|j dkr3|dkr3d}tjt|d |jt|d |d W d    d S 1 s,w   Y  d S |jt|d |d}tddgd	d
gg}t|| d S )Nz65248E10 11
55555E55 22
pyarrowr,   z6the 'pyarrow' engine does not support regex separatorsmatch)headerr+   g  jC   g!E(E VL   )	enginepytestraises
ValueErrorr   r   r   r   r   )r   r+   r   r   msgr   r   r   r   r   test_integer_overflow_bugh   s   
r8   c                 C   s>   | }d}| t|}tddgdtjgd}t|| d S )Nz
A,B
0,0
0,r   )r
   r   )r   r   r   npnanr   r   )r   r   r   r   r   r   r   r   test_int64_min_issuesx   s
   r;   convc           
      C   s   d}| }|d u r1|j dkrtjjdd}|| |t|}tg ddgd}t	|| d S d
g d	}t}	|j dkrCt}	d
}tj|	|d |jt|d|id W d    d S 1 saw   Y  d S )NzID
00013007854817840016671868
00013007854817840016749251
00013007854817840016754630
00013007854817840016781876
00013007854817840017028824
00013007854817840017963235
00013007854817840018860166r-   zparses to float64)reason)00013007854817840016671868000130078548178400167492510001300785481784001675463000013007854817840016781876000130078548178400170288240001300785481784001796323500013007854817840018860166IDr   |)z)Python int too large to convert to C longzlong too big to convertzint too big to convertzBThe 'converters' option is not supported with the 'pyarrow' enginer.   )
converters)r3   r4   markxfailapplymarkerr   r   r   r   r   joinOverflowErrorr6   r5   )
r   r<   requestr   r   rH   r   r   r7   errr   r   r   test_int64_overflow   s,   

	
"rO   valc                 C   s4   | }|j tt|d d}t|g}t|| d S Nr0   r   r   strr   r   r   r   rP   r   r   r   r   r   r   test_int64_uint64_range   s   
rV   c                 C   s8   | }|j tt|d d}tt|g}t|| d S rQ   rS   rU   r   r   r   test_outside_int64_uint64_range   s   rW   exp_datal            c                 C   s8   | }d |}t|}|jt|d d}t|| d S )N
rR   )rK   r   r   r   r   r   )r   rX   r   r   r   r   r   r   r   test_numeric_range_too_wide   s
   
r[   c                 C   s>   d}| }|j t|d dd }tddgdd}t|| d S )Nz1,1;0;0;0;1;1;3844;3844;3844;1;1;1;1;1;1;0;0;1;1;0;0,,,4321583677327450765
5,1;0;0;0;1;1;843;843;843;1;1;1;1;1;1;0;0;1;1;0;0,64.0,;,4321113141090630389rR      l   "ude_ l   :a6_ )name)r   r   r   r   assert_series_equal)r   sr   r   r   r   r   r   test_integer_precision   s
   r`   )#__doc__ior   numpyr9   r4   pandasr   r   pandas._testing_testingr   rH   filterwarnings
pytestmarkusefixturesxfail_pyarrowskip_pyarrowr   parametrizer&   r*   r8   r;   int64uint64rO   iinfomaxminrV   rW   rT   r[   r`   r   r   r   r   <module>   sp      	 
!


4(
$
(