%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/lib/tests/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/lib/tests/__pycache__/test_loadtxt.cpython-39.opt-1.pyc

a

z[yc��@s*dZddlZddlZddlZddlmZmZddlmZddl	Z
ddlmZddl
mZmZmZdd�Zej�d	gd
��dd��Zejd
d��Zej�dgd��dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zej�dd�dd ��Zej�dd�d!d"��Zej�d#d$d%g�d&d'��Zej�d(gd)��d*d+��Z ej�d,d-�d.d/��Z!d0d1�Z"ej�d2e#e$f�d3d4��Z%ejj&e�o�ej'j(d5kd6d7�ej�d2e
�)d8�e
�)d9�f�d:d;���Z*d<d=�Z+d>d?�Z,d@dA�Z-dBdC�Z.ej�dDgdE��ej�dFgdE��dGdH���Z/dIdJ�Z0dKdL�Z1dMdN�Z2dOdP�Z3ej�d2dQ�dRdS��Z4ej�dTdUe
�)dV�fdWe
�)dX�fg�dYdZ��Z5d[d\�Z6d]d^�Z7ejj&e�o�ej'j(d5kd6d7�ej�d2e
j8d_�ej�9d`�dadb����Z:ejj&e�o�ej'j(d5kd6d7�ej�d2e
j8d_�ej�9d`�dcdd����Z;ej�d2e
j<e
j=f�ej�dedf�dgdh���Z>didj�Z?dkdl�Z@dmdn�ZAejj&edod7�dpdq��ZBejj&e�onej'j(d5kd6d7�drds��ZCej�dtde#gduf�dvdw��ZDejj&e�o�ej'j(d5kd6d7�dxdy��ZEej�dzd{�d|d}��ZFd~d�ZGej�d�d��d�d���ZHd�d��ZIejj&e�oej'j(d5kd6d7�d�d���ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOej�d�d��ej�d�d��ej�d�dd�g�d�d�����ZPej�dd��d�d���ZQej�d2d�gd�d�d�d�d�d�d�d�d�d�d�eRd��fd�d�eRd��fd�g�ej�d�d�d�g�d�d����ZSej�d2e
j8d_d�d��d�d���ZTej�d2d��d�d���ZUejj&e�o@ej'j(d5kd6d7�ej�d2d��ej�d�gd���d�d�����ZVejj&e�o�ej'j(d5kd6d7�ej�d2e
j8d_d�d��d�d����ZWejj&e�o�ej'j(d5kd6d7�ej�d2e
j8d_d�d��d�d„��ZXej�d�d�d�gd�d�gg�d�dDŽ�ZYej�d�d�d�gd�d�gd�d�gd�d�gg�d�d̈́�ZZej�d�gdϢ�d�dф�Z[d�dӄZ\d�dՄZ]Gd�dׄd׃Z^d�dلZ_d�dۄZ`d�d݄Zad�d߄Zbej�d,d-�d�d��Zcej�d�d�d�d��Zdej�d�d�d�g�ej�d�d�d�d���Zed�d�Zfejj&e�oej'j(d5kd6d7�d�d��Zgd�d�ZhdS)�z�
Tests specific to `np.loadtxt` added during the move of loadtxt to be backed
by C code.
These tests complement those found in `test_io.py`.
�N)�NamedTemporaryFile�mkstemp)�StringIO)�assert_equal)�assert_array_equal�HAS_REFCOUNT�IS_PYPYcCsBtd�}t�gd�gd�gd�gd�g�}ttj|dd�|�dS)	z0Test that both 'e' and 'E' are parsed correctly.zE1.0e-1,2.0E1,3.0
4.0e-2,5.0E-1,6.0
7.0e-3,8.0E1,9.0
0.0e-4,1.0E-1,2.0)皙�����?g4@�@)g{�G�z�?��?�)gy�&1�|?gT@�	)rr	��,��	delimiterN)r�np�arrayr�loadtxt)�data�expected�r�B/usr/lib64/python3.9/site-packages/numpy/lib/tests/test_loadtxt.py�test_scientific_notations��r�comment)z..z//z@-zthis is a comment:cCsDd}t|�d|��}tj|d|d�}t|ddgddgd	d
gg�dS)Nz,# IGNORE
1.5, 2.5# ABC
3.0,4.0# XXX
5.5,6.0
�#r�r�comments��?�@r
�@�@�@)r�replacerrr)rZcontent�txt�arrr�test_comment_multiple_chars"sr&cCsHtd�}t�dtjfdtjfddtjfg�}tjgd�|d�}|||fS)z|
    Fixture providing hetergeneous input data with a structured dtype, along
    with the associated structured array.
    zo1000;2.4;alpha;-34
2000;3.1;beta;29
3500;9.9;gamma;120
4090;8.1;delta;0
5001;4.4;epsilon;-99
6543;7.8;omega;-1
�f0�f1��f2ZS7�f3�)i�g333333@Zalphai���)i�g������@Zbeta�)i�
g������#@Zgamma�x)i�g333333 @Zdeltar)i�g������@�epsiloni����)i�g333333@Zomega�����dtype)rrr2�uint16�float64�int8r)rr2rrrr�mixed_types_structured*s�
��r6�skiprows)r�r�cCs2|\}}}tj||d|d�}t|||d��dS)N�;)r2rr7�rrr)r7r6rr2rr%rrr�1test_structured_dtype_and_skiprows_no_empty_linesKs
r<cCs`|\}}}tj||ddd�\}}}}t||d�t||d�t||d�t||d�dS)Nr:T)r2r�unpackr'r(r*r+r;)r6rr2rr%�b�c�drrr�test_unpack_structuredSs
rAcCsBt�ddg�}td�}tjddg|d�}ttj|d|d�|�dS)	N)r%�u1r)r>rBrz0,1,2,3
6,7,8,9
��rr8�rr9))r�)�r
r1r�rr2�rr2rrrr�r2rrrrr� test_structured_dtype_with_shape]srKcCs<t�dg�}td�}tjdg|d�}ttj||d�|�dS)N)r%rB)rrz0 1 2 3
)rCr1rIrJrrr�&test_structured_dtype_with_multi_shapedsrLcCsrt�dtfdtfg�}t�dtfd|dfg�}td�}tjddd	gfd
ddgfg|d
�}ttj||dd�|�dS)N�x�y�codeZpoints)rz100,1,2,3,4
200,5,6,7,8
�d)��?�@)r
r ��)�@r")g@g @r1r�r2r)rr2�float�intrrrr)Zpoint�dtrrrrr�test_nested_structured_subarrayks

��rYcCsBtjddd�}td�}tjddg|d�}ttj|d|d	�|�dS)
Nzi1, i4, i1, i4, i1, i4T�Zalignz1,2,3,4,5,6
7,8,9,10,11,12
)r8rr9��r)rFrGr
�
��r1rrHrI)rXrrrrr�test_structured_dtype_offsetszsr`�param)r7�max_rowscCsFtjtdd��$tjdi|di��Wd�n1s80YdS)z;skiprows and max_rows should raise for negative parameters.zargument must be nonnegative��match�foo.bar���N)re��pytest�raises�
ValueErrorrr�rarrr�"test_exception_negative_row_limits�srlcCsFtjtdd��$tjdi|di��Wd�n1s80YdS)Nzargument must be an integerrcrerQ)re�rhri�	TypeErrorrrrkrrr�$test_exception_noninteger_row_limits�srozdata, shape)z
1 2 3 4 5
)r8r\)z
1
2
3
4
5
)r\r8cCs�t�gd��}|�|�}ttjt|�td�|�ttjt|�tdd�|�ttjt|�tdd�|�ttjt|�tdd�|�dS)N)r8rr9r[r\r1r)r2�ndminr8r)rrZreshaperrrrW)r�shapeZarrZarr2drrr�test_ndmin_single_row_or_col�s
rr�badval)r0r9Nzplate of shrimpcCs@tjtdd��tjd|d�Wd�n1s20YdS)NzIllegal value of ndmin keywordrcre)rprg)rsrrr�test_bad_ndmin�srt�ws)� �	u � u cCsftd|�d|�d|�d|�d|�d��}t�gd�gd�gd	�gd
�g�}ttj|tddd�|�dS)
Nz1 2z30

z
4 5 60z
  z  
7 8 z 90
  # comment
3 2 1�r8r��r[r\�<�rFrG�Z�r9rr8r�r2rr�rrrrrrW)rur$rrrr�test_blank_lines_spaces_delimit�s����	"�r�cCsFtd�}t�gd�gd�gd�gd�g�}ttj|tddd�|�dS)	Nz&1,2,30

4,5,60

7,8,90
# comment
3,2,1ryr{r}rrrr�r�)r$rrrr�!test_blank_lines_normal_delimiter�s
"�r�r2cCsJtd�}tj||ddd�}t|j|�t|tjddgddgg|d	��dS)
Nz1.5,2.5
3.0,4.0
5.5,6.0rr)r2rrbz1.5z2.5z3.0z4.0r1)rrrrr2r�r2r$�resrrr�test_maxrows_no_blank_lines�sr�)rFr9rGzPyPy bug in error formatting)�reasonZf8�i2cCsVtd�}d|�d�}tjt|d�� tj||dd�Wd�n1sH0YdS)Nz
1,2
3,XXX
5,6z"could not convert string 'XXX' to z at row 1, column 2rcrrU�rrhrirjrr)r2r$�msgrrr�!test_exception_message_bad_values�sr�cCsVtd�}ddd�i}t�ddgdtjgdd	gg�}tj|tjd
|dd�}t||�dS)Nz1.5,2.5
3.0,XXX
5.5,6.0r0cSs|dkrtjSt|�S�NZXXX�r�nanrV��srrr�<lambda>��z2test_converters_negative_indices.<locals>.<lambda>rrr
r!r"r)r2r�
converters�encoding)rrrr�rr4r�r$�convrr�rrr� test_converters_negative_indices�s�r�cCs�td�}ddd�i}t�ddgdtjgdd	gg�}tj|tjd
|ddgdd�}t||�tjtd
�d
ddgddd�id�}t|ddgddgg�dS)Nz$1.5,2.5,3.5
3.0,4.0,XXX
5.5,6.0,7.5
r0cSs|dkrtjSt|�Sr�r�r�rrrr��r�z?test_converters_negative_indices_with_usecols.<locals>.<lambda>rg@r
r!g@rr)r2rr��usecolsr�z0,1,2
0,1,2,3,4cSsdS)Nr0r�rMrrrr��r�)rr�r�)rrrr�rr4rrr�rrr�-test_converters_negative_indices_with_usecols�s �
�r�cCs�td�}t�ddgddgddgg�}tj|tdddgd�}t||�td�}tjtdd��&tj|tdddgd�Wd�n1s�0YdS)	N�$0,0,XXX
0,XXX,0,XXX
0,XXX,XXX,0,XXX
rr����r2rr�z0,0,XXX
0
0,XXX,XXX,0,XXX
z/invalid column index -2 at row 2 with 1 columnsrc)	rrrrrVrrhrirj�r$rr�rrr�test_ragged_usecols�s
�r�cCs$td�}tj|t�g�dgd�}dS)Nr�rr�)rrrr2�r$r�rrr�test_empty_usecolssr��c1)r%uのu🫕�c2cCsntd|�d|�d��}tj|t�d�dd�}tjd|�d��d�d|�d��d�gt�d�d	�}t||�dS)
Nza,z	,c,1.0
e,z,2.0,g�U12rrUz,c,1.0ze,r1)rrrr2r�splitr)r�r�r$r�rrrr�test_large_unicode_characterss"�r�cCsXtd�}ddd�i}tj|t�d�|ddd�}t�dd	gd
dgdd
gg�}t||�dS)Nucat,dog
αβγ,δεζ
abc,def
rcSs|��S�N��upperr�rrrr�r�z-test_unicode_with_converter.<locals>.<lambda>r�r)r2r�rr�ZCATZdoguΑΒΓuδεζ�ABC�def)rrrr2rr�r$r�r�rrrr�test_unicode_with_converters�r�cCshtd�}t�dtjfdtjfdg�}dd�dd�d�}tj||d	|d
�}tjgd�|d�}t||�dS)
Nz$1.5,2.5,Abc
3.0,4.0,dEf
5.5,6.0,ghI
�m�r)rO�U8cSstdt|��S)Nr])rWrVr�rrrr�*r�z6test_converter_with_structured_dtype.<locals>.<lambda>cSs|��Sr�r�r�rrrr�*r�)rr0r)r2rr�))�rr�)rzr �DEF)�7r"ZGHIr1)rrr2Zint32�float32rrr)r$rXr�r�rrrr�$test_converter_with_structured_dtype's�r�cCsJtd�}tj}tj|t�d�|dd�}t�ddgddgg�}t||�d	S)
aL
    With the default 'bytes' encoding, tokens are encoded prior to being
    passed to the converter. This means that the output of the converter may
    be bytes instead of unicode as expected by `read_rows`.

    This test checks that outputs from the above scenario are properly decoded
    prior to parsing by `read_rows`.
    zabc,def
rst,xyzZU3r)r2r�rr�r�ZRSTZXYZN)r�bytesr�rrr2rrr�rrr�!test_converter_with_unicode_dtype2s	�r�cCsNdd}|dd�d}t|d�}tj|dtd�}t|t�dd	gd
��dS)Nz	1.5, 2.5,�P�r0�
rrrHrr)rr�)rrrrVrZtile)�rowr$r�rrr�test_read_huge_rowCs
r�ZedfgFDGcCs&d}t�|�}tj|g|d�d}dS)Na�0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.123456789r1r)rr2r)r2�field�valuerrr�test_huge_floatKs
r�)�given_dtype�expected_dtype�S�S5�UZU5cCsRtd�}tj||dd�}tjddgddgdd	gg|d
�}t||�t|j|�dS)z�
    The given dtype is just 'S' or 'U' with no length. In these cases, the
    length of the resulting dtype is determined by the longest string found
    in the file.
    zAAA,5-1
BBBBB,0-3
C,4-9
rrUZAAAz5-1ZBBBBBz0-3�Cz4-9r1N)rrrrrr2)r�r�r$r�rrrr�test_string_no_length_givenTs
�
r�cCsBgd�}td�|��}t�|�}t�dd�|D��}t||�dS)z�
    Some tests that the conversion to float64 works as accurately as the
    Python built-in `float` function. In a naive version of the float parser,
    these strings resulted in values that were off by an ULP or two.
    )z0.9999999999999999z9876543210.123456z5.43215432154321e+300z0.901z0.333r�cSsg|]}t|��qSr)rV)�.0r�rrr�
<listcomp>yr�z)test_float_conversion.<locals>.<listcomp>N)r�joinrrrr)�stringsr$r�rrrr�test_float_conversionjs

r�cCsPtd�}tj|tdd�}t|ddgddgg�t|�tj�ddgddgg�dS)Nz1, 0
10, -1rrUTFr8r)rrr�boolr�viewZuint8r�rrr�	test_bool}sr�Z
AllIntegerz0error:.*integer via a float.*:DeprecationWarningc	Cs�t�|�}|jdkrPt�t�� tjdg|d�Wd�qP1sD0YndD]D}t�t��&tj|�d�g|d�Wd�qT1s�0YqTdS)N�uz-1
r1)z++z+-z--z-+z2
)rr2�kindrhrirjr)r2�signrrr�test_integer_signs�s

0r�cCsFtd�}t�t�� tj||dd�Wd�n1s80YdS)Nz1.0, 2.1, 3.7
4, 5, 6rrUr�)r2r$rrr�%test_implicit_cast_float_to_int_fails�sr��with_parens)FTcCsXd}|s|�dd��dd�}tjt|�|dd�}tjgd�gd�g|d	�}t||�dS)
Nz*(1.0-2.5j),3.75,(7+-5.0j)
(4),(-19e2j),(0)�(��)rrU)y�?�g@y@�)r y����rr1)r#rrrrr)r2r�r�r�rrrr�test_complex_parsing�s�r�cCsJdd�}tj|�tdd�}t�gd�gd�gd�gd�g�}t||�dS)	Ncss0td�D]"}|�dd|�d|d��VqdS)Nr[rr��range��irrr�gen�sz%test_read_from_generator.<locals>.genrrU)rrr)r8rr8)rr[r[)r9rr
)rrrWrr�r�r�rrrr�test_read_from_generator�s"r�cCs:dd�}tj|�ddd�}tjgd�dd�}t||�dS)Ncss&td�D]}|�d|d��VqdS)Nr9rvr[r�r�rrrr��sz/test_read_from_generator_multitype.<locals>.genzi, drvrU))rg)r8g�?)rrr1)rrrrr�rrr�"test_read_from_generator_multitype�sr�cCsLdd�}tjtdd��"tj|�ddd�Wd�n1s>0YdS)NcssdD]
}|VqdS)N)z1,2s3, 5i�1r)�entryrrrr��sz)test_read_from_bad_generator.<locals>.gen�&non-string returned while reading datarczi, irrUrm)r�rrr�test_read_from_bad_generator�s
�r�zPython lacks refcountscsjt��d���fdd�}tdd�}tjtdd��$tj|td|id�Wd�n1s\0YdS)	Nrcs�dkrtd���d7��S)Ni�zfailed half-way through!r8)rjr��Zalready_read�sentinelrrr��sz/test_object_cleanup_on_read_error.<locals>.convzx
i'zat row 5000, column 1rc)r2r�)�objectrrhrirjrr)r�r$rr�r�!test_object_cleanup_on_read_error�s2r�cCsDtd�}t�t��tj|dd�Wd�n1s60YdS)z9Test exception when a character cannot be encoded as 'S'.u–r�r1Nr�)rrrr�#test_character_not_bytes_compatible�sr�r�r�cCsHd}tjt|d��"tjtd�|d�Wd�n1s:0YdS)Nz\converters must be a dictionary mapping columns to converter functions or a single callable.rc�1 2
3 4�r��rhrirnrrr)r�r�rrr�test_invalid_converter�s�r�cCs�tjtdd��&tjtd�dtid�Wd�n1s:0Ytjtdd��(tjtd�dtidd�Wd�n1s�0YdS)Nzkeys of the converters dictrcr�r%r�r)r�r�)rhrirnrrrrWrrrr�+test_converters_dict_raises_non_integer_key�s4r��bad_col_ind)r9rfcCsLtd�}tjtdd��"tj||tid�Wd�n1s>0YdS)Nr�zconverter specified for columnrcr�)rrhrirjrrrW)r�rrrr�'test_converters_dict_raises_non_col_key�sr�cCsHtjtdd��&tjtd�ddid�Wd�n1s:0YdS)Nz4values of the converters dictionary must be callablercr�rr8r�r�rrrr�,test_converters_dict_raises_val_not_callables�r��q)�"�'�`c
Csrt|�d|�d|�d|�d|�d|�d��}t�ddtjfg�}tjgd	�|d
�}tj||d|d�}t||�dS)
N�alpha, xz, 2.5
�beta, yz, 4.5
�gamma, zz, 5.0
)r'r�r())r�r)r�g@)r�rTr1r�r2r�	quotechar)rrr2r4rrr)r�r$r2rr�rrr�test_quoted_fields&��r�cCs�td�}t�ddtjfdtjfg�}tjtdd�� tj||dd�Wd	�n1sX0Y|�d
�tj	dg|d�}tj||dd
d�}t
||�d	S)z1Support for quoted fields is disabled by default.z"lat,long", 45, 30
)r'ZU24r(r*zthe number of columns changedrcrrUNr)zlat,longg�F@g>@r1r�r�)rrr2r4rhrirjr�seekrr)r$r2rr�rrr�test_quote_support_defaults.
r�cCsNtd�}d}tjt|d�� tj|ddd�Wd�n1s@0YdS)N�1,2
3,4z,.*must be a single unicode character or Nonercrz''�rr��rrhrirnrr)r$r�rrr�test_quotechar_multichar_error)sr�cCs�td�}d}tjt|d��"tj|dddd�Wd�n1sB0Ytjt|d��&tj|ddd	gdd�Wd�n1s�0Ytj|dd
dd�}t|dd
gddgg�dS)Nr�zWwhen multiple comments or a multi-character comment is given, quotes are not supported.rcrZ123r�)rrr�r�%)rr�r8rr9r[)rrhrirjrrr)r$r�r�rrr�'test_comment_multichar_error_with_quote2s�04rcCs^td�}t�dtjfdtjfddtjfg�}tjgd�|d�}tj||dd	d
�}t||�dS)Nz{1000;2.4;'alpha';-34
2000;3.1;'beta';29
3500;9.9;'gamma';120
4090;8.1;'delta';0
5001;4.4;'epsilon';-99
6543;7.8;'omega';-1
r'r(r)r+r,r1r:r�r�)	rrr2r3r4r5rrr)rr2rr�rrr�!test_structured_dtype_with_quotesBs�
��rcCs:td�}tjgd�dd�}tj|dddd�}t||�dS)Nz	1

"4"
""��1�4r��U1r1rr��rr2r��rrrrrr�rrr�test_quoted_field_is_not_empty_sr	cCs:td�}tjgd�dd�}tj|dddd�}t||�dS)Nz1

"4"
"rrr1rr�rrr�rrr�(test_quoted_field_is_not_empty_nonstrictesr
cCs6td�}tjddd�}tj|dddd�}t||�dS)Nz"Hello, my name is ""Monty""!"zHello, my name is "Monty"!ZU40r1rr�r�rr�rrr�"test_consecutive_quotechar_escapedmsrr)r�z


z# 1 2 3
# 4 5 6
rp)rr8rr��r8rr9c	Cs�|durd}n|dkrd}nd}t|�}tjtdd�� tj|||d�}Wd�n1s\0Ytd	d
��b}|�|�|�d�tjtdd�� tj|||d�}Wd�n1s�0YWd�n1s�0YdS)zDCheck that a UserWarning is emitted when no data is read from input.N)rr9rrD)r�input contained no datarc)rpr��w)�moder)	rrh�warns�UserWarningrrr�writer�)rrpr�Zexpected_shaper$r��fhrrr�test_warn_on_no_datats.

.rrEcCsLd}t|�}tjtdd��tj||d�Wd�n1s>0YdS)Nz1 2 3
4 5 6r
rc)r7)rrhrrrr)r7rr$rrr�test_warn_on_skipped_data�srr�)r�r8)Zu2r8)Zi4�)Zu4r)Zi8�
)�u8r)Zfloat16g#�{?)r�g��. �7)�	complex64y��. �7���`F$:)r4g��
complex128ywfUD3":�)Z
longdoublerZclongdoubleyp`P@0 �B�B)ZU2u𐈃򠬌�swapTFcCsRt�|�}d|�d�g}|r$|��}tjdd|fgdd�}tj||dddd	�}dS)
Nzx,r�)r%ZS1r>FrZrr8)r2rr�rb)rr2Znewbyteorderr)r2r�rrZfull_dtr�rrr�test_byteswapping_and_unaligned�s
�rZefdFD�?cCs8td�}tj||ddd�}t|t�ddg��|��dS)Nu 3 ," 2
"rr�r�r9r)rrrrrZastyper�rrr�!test_unicode_whitespace_stripping�srZFDcCsBd}||�dd�g}tj||dd�}t|t�gd�gd��dS)Nz0 1 , 2+3j , ( 4+5j ), ( 6+-7j )  , 8j , ( 9j ) 
rvu rrU)r8y@@y@@y@�y @y"@r)r#rrrr)r2�linerr�rrr�)test_unicode_whitespace_stripping_complex�sr r�)z1 +2jz1+ 2jz1+2 jz1+-+3z(1jz(1z(1+2jz1+2j)cCsDt�t��&tj|dg|dd�Wd�n1s60YdS)Nr�rrUrg)r2r�rrr�test_bad_complex�sr!ZefgdFDGcCsX|��dkrt�d�t�t��$tjdg|ddd�Wd�n1sJ0YdS)N�gz0longdouble/clongdouble assignment may misbehave.z1rr�r�)�lowerrh�xfailrirjrrr1rrr�test_nul_character_error�s
r%cCsb|dkrt�d�|dvr$t�d�t�t�� tjdg|d�Wd�n1sT0YdS)N�ez5half assignment currently uses Python float converterZeGz2clongdouble assignment is buggy (uses `complex`?).z1_1
r1)rh�skipr$rirjrrr1rrr�test_no_thousands_support�s

r(z1,2
z2
,3
z2
,3
cCsDd}tjt|d��tj|dd�Wd�n1s60YdS)Nz7Found an unquoted embedded newline within a single linercrrrg)rr�rrr�test_bad_newline_in_iterator�sr)z2,3
z'2
',3
z'2
',3
z'2
',3
cCs*tj|ddd�}t|ddgddgg�dS)Nrr�r�rQrRr
r;)rr�rrr�test_good_newline_in_iterator�sr*�newline)r��
�
csTgd�}�fdd�|D�}tj|tddd�}t|dd���gd	d
��d�gg�dS)N)z1,"2
"
z3,"4
z1"
csg|]}|�d���qS)r�)r#)r�r��r+rrr�r�z2test_universal_newlines_quoted.<locals>.<listcomp>rr�r�r�2�3r)rrr�r)r+rr�rr.r�test_universal_newlines_quotedsr1cCs@tjddgdd�}t|gd�gd�g�tjddgd	td
�}dS)Nz123
z456�rr)r[r\rz1,2,3
z4,5,6rrH)rrrr�)r�rrr�test_null_characters
�r3cCsRGdd�d�}tjtdd��"tj|�tdd�Wd�n1sD0YdS)Nc@seZdZdd�Zdd�ZdS)z:test_iterator_fails_getting_next_line.<locals>.BadSequencecSsdS)NrPr��selfrrr�__len__#szBtest_iterator_fails_getting_next_line.<locals>.BadSequence.__len__cSs"|dkrtd��|�d|d��S)N�2�Bad things happened!z, r8)�RuntimeError)r5�itemrrr�__getitem__&szFtest_iterator_fails_getting_next_line.<locals>.BadSequence.__getitem__N)�__name__�
__module__�__qualname__r6r;rrrr�BadSequence"sr?r8rcrrU)rhrir9rrrW)r?rrr�%test_iterator_fails_getting_next_line!s	r@c@sVeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	j
�d
gd��dd��ZdS)�TestCReaderUnitTestscCsNtjtdd��,tjjjt�t�d�dd�Wd�n1s@0YdS)Nz.*readrcr�T�r2�filelike)	rhri�AttributeErrorr�core�_multiarray_umath�_load_from_fileliker�r2r4rrr�test_not_an_filelike2s�z)TestCReaderUnitTests.test_not_an_filelikecCs\Gdd�d�}tjtdd��,tjjj|�t�d�dd�Wd�n1sN0YdS)Nc@seZdZdZdd�ZdS)zBTestCReaderUnitTests.test_filelike_read_fails.<locals>.BadFileLikercSs$|jd7_|jdkr td��dS)Nr8��Bad bad bad!z1,2,3
)�counterr9�r5�sizerrr�read>s
zGTestCReaderUnitTests.test_filelike_read_fails.<locals>.BadFileLike.readN�r<r=r>rKrNrrrr�BadFileLike;srPrJrcr�TrB)rhrir9rrErFrGr2�r5rPrrr�test_filelike_read_fails7s
	�z-TestCReaderUnitTests.test_filelike_read_failscCs\Gdd�d�}tjtdd��,tjjj|�t�d�dd�Wd�n1sN0YdS)Nc@seZdZdZdd�ZdS)z@TestCReaderUnitTests.test_filelike_bad_read.<locals>.BadFileLikercSsdS)Ni�rrLrrrrNPszETestCReaderUnitTests.test_filelike_bad_read.<locals>.BadFileLike.readNrOrrrrrPMsrPr�rcr�TrB)rhrirnrrErFrGr2rQrrr�test_filelike_bad_readHs��z+TestCReaderUnitTests.test_filelike_bad_readcCsNtjtdd��,tjjjt�t�d�dd�Wd�n1s@0YdS)Nz/error reading from object, expected an iterablercr�FrB�	rhrirnrrErFrGr�r2r4rrr�test_not_an_iterXs��z%TestCReaderUnitTests.test_not_an_itercCsHtjtdd��&tjjjt�ddd�Wd�n1s:0YdS)Nzinternal error: dtype mustrcr�FrB)rhrirnrrErFrGr�r4rrr�
test_bad_type^s�z"TestCReaderUnitTests.test_bad_typecCsPtjtdd��.tjjjt�t�d�ddd�Wd�n1sB0YdS)Nzencoding must be a unicodercr�F�{)r2rCr�rTr4rrr�test_bad_encodingcs�z&TestCReaderUnitTests.test_bad_encodingr+)r,r�r-cCs\td�d|�dd�}tjjj|t�d�dddd	d
�}t|dd�dfdd
|��ddg�dS)Nz0
1
"2
"
3
4 #
r�r�r.ZU10Tr�rr8)r2rC�quoterZ	skiplinesrrr/r0z4 )rr#rrErFrGr2r)r5r+rr�rrr�test_manual_universal_newlineshs��z3TestCReaderUnitTests.test_manual_universal_newlinesN)
r<r=r>rHrRrSrUrVrXrh�mark�parametrizerZrrrrrA/srAcCsFtjtdd��$tjtd�ddd�Wd�n1s80YdS)N�".*control characters.*incompatiblerc�1, 2, 3rrr�rrrr�'test_delimiter_comment_collision_raisesxsr_cCsFtjtdd��$tjtd�ddd�Wd�n1s80YdS)Nr]rcr^rr�r�rrrr�)test_delimiter_quotechar_collision_raises}sr`cCsFtjtdd��$tjtd�ddd�Wd�n1s80YdS)Nr]rc�1 2 3r)rr�r�rrrr�'test_comment_quotechar_collision_raises�srbcCsJtjtdd��(tjtd�dddgd�Wd�n1s<0YdS)Nz0Comment characters.*cannot include the delimiterrcr^rrrr�rrrr�5test_delimiter_and_multiple_comments_collision_raises�s�rccCs�tjtdd��<tjtd|�d|�d|�d|�d�	�|d�Wd�n1sP0Ytjtdd��<tjtd|�d|�d|�d|�d�	�|d	�Wd�n1s�0YdS)
Nr]rcrr/z3
4�5z6
�r�r�r�)rurrr�,test_collision_with_default_delimiter_raises�sJrg�nl)r�r,cCs�td|�d|�d|�|�d|�d|�d|�|���}d}tjt|d��tj||d	�Wd�n1sj0Ytjt|d��tj||d
�Wd�n1s�0Ytjt|d��tj||d�Wd�n1s�0YdS)Nrr/r0rrd�6z&control character.*cannot be a newlinercrrerfr�)rhr$r�rrr�%test_control_character_newline_raises�s4,,rj)�generic_data�
long_datum�unitless_dtyper�)z2012-03z
2013-01-15ZM8zM8[D])�
spam-a-lot�tis_but_a_scratchr��U17�nrows)r]r��`�cCs�|gd|g}tj||d�}td�|��}tj||d�}t||�t�\}	}
t�|	�t	|
d�� }|�
d�|��Wd�n1s�0Ytj|
|d�}t�|
�t||�dS)z�Check that the correct unit (e.g. month, day, second) is discovered from
    the data when a user specifies a unitless datetime.r�r1r�rN�rrrr�rrr�os�close�openr�remove)rkrlrmr�rqrrr$r%�fd�fnamerrrr�test_parametric_unit_discovery�s


.
rzcCs�dgddg}tjdgddgdd�}dd�}td	�|��}tj|d
|dd�}t||�t�\}}t�|�t	|d�� }|�
d	�|��Wd�n1s�0Ytj|d
|dd�}t�|�t||�dS)
NrnrrZXXXtis_but_a_scratchrorpr1cSs
|�d�Sr�)�stripr�rrrr��r�z>test_str_dtype_unit_discovery_with_converter.<locals>.<lambda>r�r�)r2r�r�rrs)rrr�r$r%rxryrrrr�,test_str_dtype_unit_discovery_with_converter�s�


.
r|cCstjtdd��"tjtd�dd�Wd�n1s60Ytjtdd��"tjtd�dd�Wd�n1sv0Ytjtdd��"tjtd�dd�Wd�n1s�0Ytjtdd��&tjtd�d	dgd�Wd�n1s�0YdS)
Nz#Text reading control character mustrcrar�rrfz"comments cannot be an empty stringrer)rhrirnrrrrjrrrr�test_control_character_empty�s000r}cCs&tjtd�ddd�}t|gd��dS)z<Byte control characters (comments, delimiter) are supported.z
#header
1,2,3�#�,)rrrN)rrrr)r%rrr� test_control_characters_as_bytes�sr�)i�__doc__�sysrtrhZtempfilerr�iorZnumpyrZnumpy.ma.testutilsrZ
numpy.testingrrrrr[r\r&Zfixturer6r<rArKrLrYr`rlrorrrtr�r�rVr�r�Zskipif�implementation�versionr2r�r�r�r�r�r�r�r�r�r�r�r�r�r�Z	typecodes�filterwarningsr�r�rrr�r�r�r�r�r�r�r�r�r�r�r�r�rrr	r
rrr�reprrrr r!r%r(r)r*r1r3r@rAr_r`rbrcrgrjrzr|r}r�rrrr�<module>s�

 



��


�


�

��

�
�




�

	�



�



��


	����	���
	�


I�


���


Zerion Mini Shell 1.0