a
    DBìjK  ã                   @   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   úf/mnt/bigstor/www/usecases/.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 )Nz»Numbers
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r„t}	d
}tj|	|d��& |jt|ƒd|id� W d   ƒ n1 s¾0    Y  d S )Nz¿ID
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_dataéÿÿÿÿl            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 )Nz—1,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   �"udÔeÊ_ 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(ÿ
$ÿ
(