a
    PfK                     @   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:DeprecationWarningZpyarrow_xfailZ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/ai-form-bot/venv/lib/python3.9/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)yesZYesZYES)noNOZNo)Ztrue_valuesZfalse_valueszA,B
TRUE,1
FALSE,2
TRUE,3zA,B
foo,bar
bar,fooZ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
17007000002000194Z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rd|dkrdd}tjt|d$ |jt|d |d W d    n1 sV0    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    2r/   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
    r2   convc           
      C   s   d}| }|d u r`|j dkr2tjjdd}|| |t|}tg ddgd}t	|| nhd
g d	}t}	|j dkrt}	d
}tj|	|d& |jt|d|id W d    n1 s0    Y  d S )NzID
00013007854817840016671868
00013007854817840016749251
00013007854817840016754630
00013007854817840016781876
00013007854817840017028824
00013007854817840017963235
00013007854817840018860166r$   zparses to float64)reason)Z00013007854817840016671868Z00013007854817840016749251Z00013007854817840016754630Z00013007854817840016781876Z00013007854817840017028824Z00013007854817840017963235Z00013007854817840018860166Z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)r*   r+   markZxfailZapplymarkerr   r   r   r   r   joinOverflowErrorr-   r,   )
r   r3   requestr   r   r7   r   r   r.   errr   r   r   test_int64_overflow   s*    

	
r<   valc                 C   s4   | }|j tt|d d}t|g}t|| d S Nr'   r   r   strr   r   r   r   r=   r   r   r   r   r   r   test_int64_uint64_range   s    
rC   c                 C   s8   | }|j tt|d d}tt|g}t|| d S r>   r@   rB   r   r   r   test_outside_int64_uint64_range   s    rD   exp_datal            c                 C   s8   | }d |}t|}|jt|d d}t|| d S )N
r?   )r8   r   r   r   r   r   )r   rE   r   r   r   r   r   r   r   test_numeric_range_too_wide   s
    
rH   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,;,4321113141090630389r?      l   "ude_ l   :a6_ )name)r   r   r   r   Zassert_series_equal)r   sr   r   r   r   r   r   test_integer_precision   s
    rL   )#__doc__ior   numpyr0   r+   Zpandasr   r   Zpandas._testingZ_testingr   r7   filterwarningsZ
pytestmarkZusefixturesZxfail_pyarrowZskip_pyarrowr   Zparametrizer   r!   r/   r2   Zint64Zuint64r<   ZiinfomaxminrC   rD   rA   rH   rL   r   r   r   r   <module>   sn     	 
!


4(
$
(