a :jgJ@srdZddlZddlZddlZddlmZmZddlmZddl Z ddl m Z ddl mZmZmZddZejd gd d d Zejd dZejdgdddZddZddZddZddZddZejdddd Zejddd!d"Zejd#d$d%gd&d'Zejd(gd)d*d+Z ejd,d-d.d/Z!d0d1Z"ejd2e#e$fd3d4Z%ejj&eoej'j(d5kd6d7ejd2e )d8e )d9fd:d;Z*dd?Z,d@dAZ-dBdCZ.dDdEZ/ejdFgdGejdHgdGdIdJZ0dKdLZ1dMdNZ2dOdPZ3dQdRZ4ejd2dSdTdUZ5ejdVdWe )dXfdYe )dZfgd[d\Z6d]d^Z7d_d`Z8ejj&eoej'j(d5kd6d7ejd2e j9daej:dbdcddZ;ejj&eoej'j(d5kd6d7ejd2e j9daej:dbdedfZfejdgdhdidjZ?dkdlZ@dmdnZAdodpZBejj&e dqd7drdsZCejj&eovej'j(d5kd6d7dtduZDejdvde#gdwfdxdyZEejj&eoej'j(d5kd6d7dzd{ZFejd|d}d~dZGddZHejddddZIejddddZJddZKejj&eo2ej'j(d5kd6d7ddZLddZMddZNddZOddZPddZQejddejddejdddgddZRejddddZSejd2dgdddddddddddeTdfddeTdfdgejdddgddZUejd2e j9daddddZVejd2dddZWejj&eo^ej'j(d5kd6d7ejd2dejdgdddZXejj&eoej'j(d5kd6d7ejd2e j9daddddĄZYejj&eoej'j(d5kd6d7ejd2e j9daddddƄZZejdddgddggdd˄Z[ejdddgddgddgddggddфZ\ejdgdӢddՄZ]ddׄZ^ddلZ_GddۄdۃZ`dd݄Zadd߄ZbddZcddZdejd,d-ddZeejddddZfejdddgejddddZgddZhejj&eo,ej'j(d5kd6d7ddZiddZjej:dddZkejddddZldS)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)NamedTemporaryFilemkstemp)StringIO) assert_equal)assert_array_equal HAS_REFCOUNTIS_PYPYcCsBtd}tgdgdgdgdg}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{Gz??)gy&1|?gT@ )rr , delimiterN)rnparrayrloadtxt)dataexpectedrF/usr/local/lib/python3.9/site-packages/numpy/lib/tests/test_loadtxt.pytest_scientific_notationsrcomment)z..z//z@-zthis is a comment:cCsDd}t|d|}tj|d|d}t|ddgddgd d ggdS) Nz,# IGNORE 1.5, 2.5# ABC 3.0,4.0# XXX 5.5,6.0 #rrcomments?@r @@@)rreplacerrr)rcontenttxtarrrtest_comment_multiple_chars"sr'cCsHtd}tdtjfdtjfddtjfg}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 f0f1f2ZS7f3)ig333333@alphai)ig@beta)i g#@gammax)ig333333 @deltar)ig@epsiloni)ig333333@omegadtype)rrr8uint16float64int8r)rr8rrrrmixed_types_structured*s  r<skiprows)rrcCs2|\}}}tj||d|d}t|||ddS)N;)r8rr=rrr)r=r<rr8rr&rrr1test_structured_dtype_and_skiprows_no_empty_linesKs rBcCs`|\}}}tj||ddd\}}}}t||dt||dt||dt||ddS)Nr@T)r8runpackr(r)r+r,rA)r<rr8rr&bcdrrrtest_unpack_structuredSs  rGcCsBtddg}td}tjddg|d}ttj|d|d|dS) N)r&u1r)rDrHrz0,1,2,3 6,7,8,9 rr>rr?))r )r r7rrr8rr8rrrrr8rrrrr test_structured_dtype_with_shape]srQcCs<tdg}td}tjdg|d}ttj||d|dS)N)r&rH)rrz0 1 2 3 )rIr7rOrPrrr&test_structured_dtype_with_multi_shapeds rRcCsrtdtfdtfg}tdtfd|dfg}td}tjddd gfd d d gfg|d }ttj||dd|dS)NxycodeZpoints)rz100,1,2,3,4 200,5,6,7,8 d)?@)r r )@r")g@g @r7rr8r)rr8floatintrrrr)pointdtrrrrrtest_nested_structured_subarrayks  r`cCsBtjddd}td}tjddg|d}ttj|d|d |dS) Nzi1, i4, i1, i4, i1, i4Talignz1,2,3,4,5,6 7,8,9,10,11,12 )r>rr?r )rLrMr r7rrNrO)r_rrrrrtest_structured_dtype_offsetszsrhparam)r=max_rowscCsFtjtdd$tjdi|diWdn1s80YdS)z;skiprows and max_rows should raise for negative parameters.zargument must be nonnegativematchfoo.barN)rmpytestraises ValueErrorrrrirrr"test_exception_negative_row_limitssrtcCsFtjtdd$tjdi|diWdn1s80YdS)Nzargument must be an integerrkrmrW)rmrprq TypeErrorrrrsrrr$test_exception_noninteger_row_limitssrwz data, shape)z 1 2 3 4 5 )r>rd)z 1 2 3 4 5 )rdr>cCstgd}||}ttjt|td|ttjt|tdd|ttjt|tdd|ttjt|tdd|dS)N)r>rr?rcrdr7r)r8ndminr>r)rrZreshaperrrr])rshapeZarrZarr2drrrtest_ndmin_single_row_or_cols  rzbadval)r6r?Nzplate of shrimpcCs@tjtddtjd|dWdn1s20YdS)NzIllegal value of ndmin keywordrkrm)rxro)r{rrrtest_bad_ndminsr|ws)  u  u c Csftd|d|d|d|d|d }tgdgdgd gd g}ttj|tdd d |dS) Nz1 2z30 z 4 5 60z z 7 8 z 90 # comment 3 2 1r>rrcrd<rLrMZr?rr>rr8rrrrrrrr])r}r%rrrrtest_blank_lines_spaces_delimits  "rcCsFtd}tgdgdgdgdg}ttj|tddd|dS) Nz&1,2,30 4,5,60 7,8,90 # comment 3,2,1rrrrrrrr)r%rrrr!test_blank_lines_normal_delimiters "rr8cCsJtd}tj||ddd}t|j|t|tjddgddgg|d dS) Nz1.5,2.5 3.0,4.0 5.5,6.0rrr8rrjz1.5z2.5z3.0z4.0r7)rrrrr8rr8r%resrrrtest_maxrows_no_blank_liness r)rLr?rMzPyPy bug in error formatting)reasonZf8i2cCsVtd}d|d}tjt|d tj||ddWdn1sH0YdS)Nz 1,2 3,XXX 5,6z"could not convert string 'XXX' to z at row 1, column 2rkrr[rrprqrrrr)r8r%msgrrr!test_exception_message_bad_valuess rcCsTtd}dddi}tddgdtjgdd gg}tj|tjd |d }t||dS) Nz1.5,2.5 3.0,XXX 5.5,6.0r6cSs|dkrtjSt|SNXXXrnanr\srrrz2test_converters_negative_indices..rrr r!r"rr8r converters)rrrrrr:rr%convrrrrr test_converters_negative_indicess  rcCstd}dddi}tddgdtjgdd gg}tj|tjd |d dgd }t||tjtd d d dgdddid}t|d dgd dggdS)Nz$1.5,2.5,3.5 3.0,4.0,XXX 5.5,6.0,7.5 r6cSs|dkrtjSt|Srrrrrrrrz?test_converters_negative_indices_with_usecols..rg @r r!g@rr)r8rrusecolsz0,1,2 0,1,2,3,4cSsdS)Nr6rrSrrrrr)rrr)rrrrrr:rrrrrr-test_converters_negative_indices_with_usecolss   rcCsHgd}tjtddtj|ddWdn1s:0YdS)N)1,2,3rz4,3,2,1z2the number of columns changed from 3 to 4 at row 3rkrrro)rowsrrrtest_ragged_errors rcCstd}tddgddgddgg}tj|tdddgd}t||td}tjtdd&tj|tdddgdWdn1s0YdS) N$0,0,XXX 0,XXX,0,XXX 0,XXX,XXX,0,XXX rrr8rrz0,0,XXX 0 0,XXX,XXX,0,XXX z/invalid column index -2 at row 2 with 1 columnsrk) rrrrr\rrprqrrr%rrrrrtest_ragged_usecolss rcCsFtd}tj|tgdgd}|jdks.J|jtgksBJdS)Nrrr)r?)rrrr8ryr%rrrrtest_empty_usecols src1)r&uのu🫕c2cCsntd|d|d}tj|tddd}tjd|ddd|ddgtdd }t||dS) Nza,z ,c,1.0 e,z,2.0,gU12rr[z,c,1.0ze,r7)rrrr8rsplitr)rrr%rrrrrtest_large_unicode_characterss"rcCsXtd}dddi}tj|td|ddd}tdd gd d gd d gg}t||dS)Nucat,dog αβγ,δεζ abc,def rcSs|SNupperrrrrr rz-test_unicode_with_converter..rrr8rrencodingZCATdoguΑΒΓuδεζABCdef)rrrr8rrr%rrrrrrtest_unicode_with_converters rcCshtd}tdtjfdtjfdg}ddddd}tj||d |d }tjgd |d }t||dS) Nz$1.5,2.5,Abc 3.0,4.0,dEf 5.5,6.0,ghI mr)rUU8cSstdt|S)Nre)r]r\rrrrr/rz6test_converter_with_structured_dtype..cSs|Srrrrrrr/r)rr6rr))rr)rr DEF)7r"ZGHIr7)rrr8Zint32float32rrr)r%r_rrrrrr$test_converter_with_structured_dtype,srcCsLtd}tj}tj|td|ddd}tddgdd gg}t||d S) aD With the '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,xyzZU3rbytesrrrZRSTZXYZN)rrrrrr8rrrrrr!test_converter_with_unicode_dtype7s rcCsNdd}|ddd}t|d}tj|dtd}t|tdd gd dS) Nz 1.5, 2.5,Pr6 rrrNrr)rr)rrrr\rZtile)rowr%rrrrtest_read_huge_rowIs  rZedfgFDGcCs8d}t|}tj|g|dd}||dks4JdS)Na0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.123456789r7rz 0.123456789)rr8rtype)r8fieldvaluerrrtest_huge_floatQs r) given_dtypeexpected_dtypeSS5UZU5cCsRtd}tj||dd}tjddgddgdd gg|d }t||t|j|d S) 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 rr[ZAAAz5-1ZBBBBBz0-3Cz4-9r7N)rrrrrr8)rrr%rrrrrtest_string_no_length_givenZs  rcCsBgd}td|}t|}tdd|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.333rcSsg|] }t|qSr)r\).0rrrr rz)test_float_conversion..N)rjoinrrrr)stringsr%rrrrrtest_float_conversionps  rcCs^td}tj|tdd}|jtks&Jt|ddgddggt|tjddgddggdS)Nz 1, 0 10, -1rr[TFr>r)rrrboolr8rviewZuint8rrrr test_bools rZ AllIntegerz0error:.*integer via a float.*:DeprecationWarningc Cst|}tjdg|ddks"J|jdkrhtt tjdg|dWdq1s\0Yntjdg|ddksJdD]D}tt&tj|d g|dWdq1s0YqdS) Nz+2r7ruz-1 z-2 r)z++z+-z--z-+z2 )rr8rkindrprqrr)r8signrrrtest_integer_signss   0 rcCsFtd}tt tj||ddWdn1s80YdS)Nz1.0, 2.1, 3.7 4, 5, 6rr[r)r8r%rrr%test_implicit_cast_float_to_int_failss r with_parens)FTcCsXd}|s|dddd}tjt||dd}tjgdgdg|d }t||dS) Nz*(1.0-2.5j),3.75,(7+-5.0j) (4),(-19e2j),(0)()rr[)y?g@y@)r yrr7)r#rrrrr)r8rrrrrrrtest_complex_parsingsrcCsJdd}tj|tdd}tgdgdgdgdg}t||dS) Ncss0tdD]"}|dd|d|dVqdS)Nrcrrrangeirrrgens z%test_read_from_generator..genrr[)rrr)r>rr>)rrcrc)r?r r )rrr]rrrrrrrrtest_read_from_generators"rcCs:dd}tj|ddd}tjgddd}t||dS)Ncss&tdD]}|d|dVqdS)Nr?r~rcrrrrrrs z/test_read_from_generator_multitype..genzi, dr~r[))rg)r>g?)rr r7)rrrrrrrr"test_read_from_generator_multitypesrcCsLdd}tjtdd"tj|dddWdn1s>0YdS)NcssgdEdHdS)N)z1,2s3, 5i1rrrrrrsz)test_read_from_bad_generator..gen&non-string returned while reading datarkzi, irr[ru)rrrrtest_read_from_bad_generators rzPython lacks refcountscs|tdfdd}tdd}tjtdd$tj|td|idWdn1s\0Ytd ksxJdS) Nrcsdkrtdd7S)Nizfailed half-way through!r>)rrrZ already_readsentinelrrrsz/test_object_cleanup_on_read_error..convzx 'zat row 5000, column 1rkr8rr) objectrrprqrrrrsys getrefcount)rr%rrr!test_object_cleanup_on_read_errors 2rcCsDtd}tttj|ddWdn1s60YdS)z9Test exception when a character cannot be encoded as 'S'.u–rr7Nr)rrrr#test_character_not_bytes_compatibles rrrcCsHd}tjt|d"tjtd|dWdn1s:0YdS)Nz\converters must be a dictionary mapping columns to converter functions or a single callable.rk1 2 3 4rrprqrvrrr)rrrrrtest_invalid_convertersrcCstjtdd&tjtddtidWdn1s:0Ytjtdd(tjtddtiddWdn1s0YdS)Nzkeys of the converters dictrkrr&rr)rr)rprqrvrrrr]rrrr+test_converters_dict_raises_non_integer_keys4r bad_col_ind)r?rncCsLtd}tjtdd"tj||tidWdn1s>0YdS)Nrzconverter specified for columnrkr)rrprqrrrrr])rrrrr'test_converters_dict_raises_non_col_keysrcCsHtjtdd&tjtdddidWdn1s:0YdS)Nz4values of the converters dictionary must be callablerkrrr>rrrrrr,test_converters_dict_raises_val_not_callable srq)"'`c Csrt|d|d|d|d|d|d }tddtjfg}tjgd |d }tj||d |d }t||dS) Nalpha, xz, 2.5 beta, yz, 4.5 gamma, zz, 5.0 r(rr))rr)r g@)r rZr7rr8r quotecharrrr8r:rrrrr%r8rrrrrtest_quoted_fields&rc Csrt|d|d|d|d|d|d }tddtjfg}tjgd |d }tj||d|d }t||dS) Nrz 2.5 r z 4.5 r z 5.0 r r)r r7r rrrrr*test_quoted_field_with_whitepace_delimiters&rcCstd}tddtjfdtjfg}tjtdd tj||ddWd n1sX0Y|d tj d g|d }tj||dd d}t ||d S)z1Support for quoted fields is disabled by default.z"lat,long", 45, 30 )r(ZU24r)r+z.the dtype passed requires 3 columns but 4 wererkrr[Nr)zlat,longgF@g>@r7rr ) rrr8r:rprqrrrseekrr)r%r8rrrrrtest_quote_support_default,s. rcCsNtd}d}tjt|d tj|dddWdn1s@0YdS)N1,2 3,4z,.*must be a single unicode character or Nonerkrz''rrrrprqrvrr)r%rrrrtest_quotechar_multichar_error=srcCstd}d}tjt|d"tj|ddddWdn1sB0Ytjt|d&tj|ddd gddWdn1s0Ytj|dd d d}t|d d gddggdS)NrzWwhen multiple comments or a multi-character comment is given, quotes are not supported.rkrZ123r)rrrr%)rrr>rr?rc)rrprqrrrrr)r%rrrrr'test_comment_multichar_error_with_quoteFs04rcCs^td}tdtjfdtjfddtjfg}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-r7r@rr ) rrr8r9r:r;rrr)rr8rrrrr!test_structured_dtype_with_quotesVs  rcCs:td}tjgddd}tj|dddd}t||dS)Nz 1 "4" ""14rU1r7rrrr8rrrrrrrrrrtest_quoted_field_is_not_emptyssr"cCs:td}tjgddd}tj|dddd}t||dS)Nz1 "4" "rrr7rrr r!rrrr(test_quoted_field_is_not_empty_nonstrictysr#cCs6td}tjddd}tj|dddd}t||dS)Nz"Hello, my name is ""Monty""!"zHello, my name is "Monty"!ZU40r7rrr r!rrrr"test_consecutive_quotechar_escapedsr$r)rz z# 1 2 3 # 4 5 6 rx)rr>rrr>rr?c Cs|durd}n|dkrd}nd}t|}tjtdd tj|||d}Wdn1s\0Y|j|kstJtd d p}||| d tjtdd tj|||d}Wdn1s0Y|j|ksJWdn1s0YdS) zDCheck that a UserWarning is emitted when no data is read from input.N)rr?rrJ)rinput contained no datark)rxrw)moder) rrpwarns UserWarningrrryrwriter)rrxrZexpected_shaper%rfhrrrtest_warn_on_no_datas.   .r-rKcCsLd}t|}tjtddtj||dWdn1s>0YdS)Nz 1 2 3 4 5 6r&rk)r=)rrpr)r*rr)r=rr%rrrtest_warn_on_skipped_datasr.r)rr>)u2r>)i4)Zu4r1)i8  )u8r3)Zfloat16g#{?)rg. 7) complex64y. 7`F$:)r:g complex128ywfUD3":)Z longdoubler3Z clongdoubleyp`P@0 BB)ZU2u𐈃򠬌swapTFcCs|t|}d|dg}|r$|}tjdd|fgdd}|jdddksPJtj||ddd }|d||ksxJdS) Nzx,r)r&ZS1rDFrar>rr)rr8Z newbyteorderfieldsrr)r8rr7rZfull_dtrrrrtest_byteswapping_and_unaligneds  r9ZefdFD?cCs8td}tj||ddd}t|tddg|dS)Nu 3 ," 2 "rrr r?r)rrrrrZastyperrrr!test_unicode_whitespace_strippingsr;ZFDcCsBd}||ddg}tj||dd}t|tgdgddS)Nz0 1 , 2+3j , ( 4+5j ), ( 6+-7j ) , 8j , ( 9j ) r~u rr[)r>y@@y@@y@y @y"@r)r#rrrr)r8linerrrrr)test_unicode_whitespace_stripping_complexsr=r)z1 +2jz1+ 2jz1+2 jz1+-+3z(1jz(1z(1+2jz1+2j)cCsDtt&tj|dg|ddWdn1s60YdS)Nrrr[ro)r8rrrrtest_bad_complexs r>ZefgdFDGcCsX|dkrtdtt$tjdg|dddWdn1sJ0YdS)Ngz0longdouble/clongdouble assignment may misbehave.1rrr )lowerrpxfailrqrrrrr7rrrtest_nul_character_errors   rCcCs|dkrtd|dvr$tdtdtdkrNtdkrNdksTnJtt tj dg|dWdn1s0YdS) Nez5half assignment currently uses Python float converterZeGz2clongdouble assignment is buggy (uses `complex`?).Z1_1rfz1_1 r7) rpskiprBr]r\complexrqrrrrr7rrrtest_no_thousands_supports  0 rGz1,2 z2 ,3 z2 ,3 cCsDd}tjt|dtj|ddWdn1s60YdS)Nz7Found an unquoted embedded newline within a single linerkrrro)rrrrrtest_bad_newline_in_iteratorsrHz2,3 z'2 ',3 z'2 ',3 z'2 ',3 cCs*tj|ddd}t|ddgddggdS)NrrrrWrXr rA)rrrrrtest_good_newline_in_iteratorsrInewline)r  csTgd}fdd|D}tj|tddd}t|ddgd d dggdS) N)z1,"2 " z3,"4 z1" csg|]}|dqS)r)r#)rrrJrrr%rz2test_universal_newlines_quoted..rrr r23r)rrrr)rJrrrrMrtest_universal_newlines_quotedsrPcCs\tjddgdd}t|gdgdgtjddgd td }|gd gd gksXJdS) Nz123 z456rr%)rcrdr z1,2,3 z4,5,6rrN)r@z2rO)z4z56)rrrrtolist)rrrrtest_null_character*s  rTcCsRGddd}tjtdd"tj|tddWdn1sD0YdS)Nc@seZdZddZddZdS)z:test_iterator_fails_getting_next_line..BadSequencecSsdS)NrVrselfrrr__len__7szBtest_iterator_fails_getting_next_line..BadSequence.__len__cSs"|dkrtd|d|dS)N2Bad things happened!z, r>) RuntimeError)rVitemrrr __getitem__:szFtest_iterator_fails_getting_next_line..BadSequence.__getitem__N)__name__ __module__ __qualname__rWr\rrrr BadSequence6sr`rYrkrr[)rprqrZrrr])r`rrr%test_iterator_fails_getting_next_line5s rac@sVeZdZddZddZddZddZd d Zd d Ze j d gdddZ dS)TestCReaderUnitTestscCsNtjtdd,tjjjttdddWdn1s@0YdS)Nz.*readrkrTr8filelike) rprqAttributeErrorr_core_multiarray_umath_load_from_filelikerr8rUrrrtest_not_an_filelikeFsz)TestCReaderUnitTests.test_not_an_filelikecCs\Gddd}tjtdd,tjjj|tdddWdn1sN0YdS)Nc@seZdZdZddZdS)zBTestCReaderUnitTests.test_filelike_read_fails..BadFileLikercSs$|jd7_|jdkr tddS)Nr> Bad bad bad!z1,2,3 )counterrZrVsizerrrreadRs zGTestCReaderUnitTests.test_filelike_read_fails..BadFileLike.readNr]r^r_rlrorrrr BadFileLikeOsrqrkrkrTrc)rprqrZrrfrgrhr8rVrqrrrtest_filelike_read_failsKs  z-TestCReaderUnitTests.test_filelike_read_failscCs\Gddd}tjtdd,tjjj|tdddWdn1sN0YdS)Nc@seZdZdZddZdS)z@TestCReaderUnitTests.test_filelike_bad_read..BadFileLikercSsdS)NirrmrrrrodszETestCReaderUnitTests.test_filelike_bad_read..BadFileLike.readNrprrrrrqasrqrrkrTrc)rprqrvrrfrgrhr8rrrrrtest_filelike_bad_read\sz+TestCReaderUnitTests.test_filelike_bad_readcCsNtjtdd,tjjjttdddWdn1s@0YdS)Nz/error reading from object, expected an iterablerkrFrc rprqrvrrfrgrhrr8rUrrrtest_not_an_iterls z%TestCReaderUnitTests.test_not_an_itercCsHtjtdd&tjjjtdddWdn1s:0YdS)Nzinternal error: dtype mustrkrFrc)rprqrvrrfrgrhrrUrrr test_bad_typersz"TestCReaderUnitTests.test_bad_typecCsPtjtdd.tjjjttddddWdn1sB0YdS)Nzencoding must be a unicoderkrF{)r8rdrrurUrrrtest_bad_encodingwsz&TestCReaderUnitTests.test_bad_encodingrJ)rKrrLcCs\tdd|dd}tjjj|tddddd d }t|ddd fd d |ddgdS)Nz0 1 "2 " 3 4 # rrrMZU10Trrr>)r8rdquoterZ skiplinesrrrNrOz4 )rr#rrfrgrhr8r)rVrJrrrrrtest_manual_universal_newlines|s  z3TestCReaderUnitTests.test_manual_universal_newlinesN) r]r^r_rirsrtrvrwryrpmark parametrizer{rrrrrbCsrbcCsFtjtdd$tjtddddWdn1s80YdS)N".*control characters.*incompatiblerk1, 2, 3rrrrrrr'test_delimiter_comment_collision_raisessrcCsFtjtdd$tjtddddWdn1s80YdS)Nr~rkrrrrrrrr)test_delimiter_quotechar_collision_raisessrcCsFtjtdd$tjtddddWdn1s80YdS)Nr~rk1 2 3r)rrrrrrr'test_comment_quotechar_collision_raisessrcCsJtjtdd(tjtddddgdWdn1s<0YdS)Nz0Comment characters.*cannot include the delimiterrkrrrrrrrrr5test_delimiter_and_multiple_comments_collision_raisessrc Cstjtdd<tjtd|d|d|d|d |dWdn1sP0Ytjtdd<tjtd|d|d|d|d |d Wdn1s0YdS) Nr~rkrrNz3 45z6 rrr)r}rrr,test_collision_with_default_delimiter_raisess Jrnl)rrKcCstd|d|d||d|d|d||}d}tjt|dtj||d Wdn1sj0Ytjt|dtj||d Wdn1s0Ytjt|dtj||d Wdn1s0YdS) NrrNrOrrrRz&control character.*cannot be a newlinerkrrrr)rr%rrrr%test_control_character_newline_raisess4,,r) generic_data long_datumunitless_dtyper)z2012-03z 2013-01-15ZM8zM8[D]) spam-a-lottis_but_a_scratchrU17nrows)rer`c Cs||g||g}tj||d}t||dks2Jt|t|ksFJtd|}tj||d}t|t|ksvJ|j|jksJt||t\} } t | t | d$} | d|dWdn1s0Ytj| |d}t|t|ksJ|j|jksJt||tj| |t |dd}t | t|t |dks^Jt||dt |ddS)zCheck that the correct unit (e.g. month, day, second) is discovered from the data when a user specifies a unitless datetime.r7r>rr'Nr)r8rj)rrlenrrrr8rroscloseopenr+r]remove) rrrrrrrr%r&fdfnamer,rrrtest_parametric_unit_discoverys*    2  rcCsdgddg}tjdgddgdd}dd}td |}tj|d |d }|j|jks`Jt||t\}}t |t |d  }| d |Wdn1s0Ytj|d |d }t ||j|jksJt||dS) NrrZXXXtis_but_a_scratchrrr7cSs |dSr)striprrrrrrz>test_str_dtype_unit_discovery_with_converter..rrrr') rrrrrr8rrrrrr+r)rrrr%r&rrr,rrr,test_str_dtype_unit_discovery_with_converters"    . rcCstjtdd"tjtdddWdn1s60Ytjtdd"tjtdddWdn1sv0Ytjtdd"tjtdddWdn1s0Ytjtdd&tjtdd dgdWdn1s0YdS) Nz#Text reading control character mustrkrrrrz"comments cannot be an empty stringrr)rprqrvrrrrrrrrrtest_control_character_emptys000rcCs&tjtdddd}t|gddS)zire)rr8rj)rrrrr)rrrrrtest_field_growing_casess rnmax)rrircCsd}dg|}td|}tj|td|d}t||ks>Jt\}}t|t |d }| d|Wdn1s0Ytj|td|d}t |t||ksJdS)Nrza 0.5 1rr~rr') rrrrstrrrrrrr+r)rZ file_lengthrr%rrrr,rrr test_maxrows_exceeding_chunksize s    . r)m__doc__rrrptempfilerriornumpyrZnumpy.ma.testutilsrZ numpy.testingrrrrr|r}r'Zfixturer<rBrGrQrRr`rhrtrwrzr|rrr\rrZskipifimplementationversionr8rrrrrrrrrrrrrrr typecodesfilterwarningsrrr5r6rrrrrrrrrrrrrrrrr"r#r$r-r.reprr9r;r=r>rCrGrHrIrPrTrarbrrrrrrrrrrrrrrrrs                                                         I     #