Current File : //usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyo
�
E�`Qc@s?ddlZejddkr>ddlmZdd�ZnddlmZddlmZddlZddlZ	dd	l
mZmZm
Z
mZmZmZdd
lTddlmZmZdefd
��YZdefd��YZd�Zdefd��YZdefd��YZedkr;e�ndS(i����Nii(tBytesIOtcCstt|��S(N(Rtasbytes(ts((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pytStringIOs(R(tdate(tLineSplittert
NameValidatortStringConverterthas_nested_fieldst
easy_dtypet
flatten_dtype(t*(Rtasbytes_nestedtTestLineSplittercBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sTests the LineSplitter class.cCsutd�}t�|�}t|tdddddg��td�|�}t|tdddddg��dS(	sTest LineSplitter w/o delimiters 1 2 3 4  5 # testt1t2t3t4t5RN(RRtassert_equalR
(tselftstrgttest((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_no_delimiters
"c	Cs~td�}ttd��|�}t|tddddddg��ttd	��|�}t|td
dg��dS(sTest space delimiters 1 2 3 4  5 # testt RRRRRRs  s1 2 3 4N(RRRR
(RRR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_space_delimiters
%cCs�td�}ttd��|�}t|tdddddg��td�}ttd��|�}t|td	d
dg��dS(sTest tab delimiters 1	 2	 3	 4	 5  6s	RRRRs5  6s 1  2	 3  4	 5  6s1  2s3  4N(RRRR
(RRR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_tab_delimiter&s"c	Cs�td�}ttd��|�}t|tddddddg��td	�}ttd��|�}t|tddddddg��d
S(sTest LineSplitter on delimiters
1,2,3,4,,5t,RRRRRRs 1,2,3,4,,5 # testN(RRRR
(RRR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_other_delimiter/s%c
Cs�td�}td�|�}t|tdddddddg��td	�}td
�|�}t|tdg��td	�}td�|�}t|tdg��d
S(s'Test LineSplitter w/ fixed-width fieldss  1  2  3  4     5   # testiRRRRRRs  1     3  4  5  6# testis1     3  4  5  6iN(RRRR
(RRR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_constant_fixed_width9s(cCs{td�}td�|�}t|tddddg��td�}td�|�}t|tdd	d
g��dS(
Ns  1     3  4  5  6# testiiRRs4  5t6i	s3  4s5  6(iiii(iii	(RRRR
(RRR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_variable_fixed_widthGs(	t__name__t
__module__t__doc__RRRRRR (((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyRs					
	tTestNameValidatorcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs�ddddg}t�j|�}t|ddddg�tdt�j|�}t|ddddg�tdd	�j|�}t|ddddg�tdd
�j|�}t|ddddg�dS(
sTest case sensitivitytAtatbtctcase_sensitivetA_1tBtCtuppertlowerta_1N(RtvalidateRtFalse(RtnamesR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_case_sensitivityUscCsVddddg}tddddg�}|j|�}t|dddd	g�d
S(sTest excludelisttdatestdatas
Other Datatmasktexcludelisttdates_tdata_t
Other_Datatmask_N(RR0R(RR2t	validatorR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_excludelistascCs�d	}t�}t||�dddg�d
}t||�dddg�d}t||�dddg�d}t||�dddg�dS(
sTest validate missing namesR&R'R(Rtf0tf1tf2N(R&R'R((RR'R((R&R'R(RR>R(RR(RtnamelistR<((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_missing_nameshs	cCsZd}t�}t||dd�d
�t||dddd�dddd	d
g�dS(sTest validate nb namesR&R'R(tnbfieldsiit
defaultfmtsg%itg0tg1N(R&R'R((R&(RR(RRAR<((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_validate_nb_namests
	cCsKd}t�}t||�dk�t||dd�dddg�dS(sTest validate no namesRCiR>R?R@N(tNoneRtassert_R(RRAR<((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_validate_wo_names|s	(R!R"R3R=RBRGRJ(((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyR$Ss
				cCsTtjddkr6ttj|jd�d�d �Sttj|d�d �SdS(Niitlatin1s%Y-%m-%d(tsystversion_infoRttimetstrptimetdecode(R((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyt_bytes_to_date�s#tTestStringConvertercBsheZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(sTest StringConvertercCs3ttd�}t|jd�t|jd�dS(s"Test creation of a StringConverteriay��iN(RtintRt_statustdefault(Rt	converter((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyt
test_creation�scCs�t�}t|jd�|jtd��t|jd�|jtd��t|jd�|jtd��t|jd�|jtd��t|jt|j�d�d	S(
sTests the upgrade method.it0is0.it0jiR&N(RRRTtupgradeRtlent_mapper(RRV((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_upgrade�s	cCs�tdtd�td�f�}|jtd��t|td��d�t|td��|j�t|td��|j�t|td��|j�y|d�Wntk
r�nXdS(	s Tests the use of missing values.tmissing_valuestmissingtmissedRXiRtmissN(RRRZRRUt
ValueError(RRV((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_missing�s
cCs�t}tj|tddd��t|tddd��}|td��}t|tddd��|td��}t|tddd��|td��}t|tddd��dS(	sTests updatemapperi�is
2001-01-01i�s
2009-01-01i�RN(RQRtupgrade_mapperRRR(Rt
dateparsertconvertR((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_upgrademapper�scCsAtt�}t|jddd�d�tt|d��dS(sAMake sure that string-to-object functions are properly recognizedi����iyRUN(RRQRR\RIthasattr(Rtconv((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_string_to_object�scCs�tddtd�dd�}|jtd��t|jd�t|jtjt	��tddtd�dd�}|jtd��t|jd�t|jtjt	��dS(s+Make sure we don't lose an explicit defaultR^RRUi���s
3.14159265iN(
RRHRRZRRUttypetnptdtypetfloat(RRV((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_keep_default�s	cCs2ttdddtd��}t|jd�dS(s'Check that we don't lose a default of 0RUiR^sN/AN(RRSRRRU(RRV((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_keep_default_zero�scCsDttdddtd��}t|jttddg���dS(s*Check that we're not losing missing valuesRUiR^sN/ARN(RRSRRR^tsetR
(RRV((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_keep_missing_values�scCs]ttjdd�}td�}t||�dk�td�}t||�dk�dS(s/Check that int64 integer types can be specifiedRUis-9223372036854775807I�t9223372036854775807I�������N(RRltint64RRI(RRVtval((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_int64_dtype�s
cCs;ttjdd�}td�}t||�dk�dS(s0Check that uint64 integer types can be specifiedRUit9223372043271415339l+&�|N(RRltuint64RRI(RRVRu((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_uint64_dtype�s(
R!R"R#RWR]RcRgRjRoRpRrRvRy(((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyRR�s		
				
			tTestMiscFunctionscBs#eZd�Zd�Zd�ZRS(cCs�tjtj�}tt|�t�tjddtfg�}tt|�t�tjdtfddtfd	gfg�}tt|�t�dS(
sTest has_nested_dtypeR%s|S3R+tBAtBBs|S1N(R%s|S3(R|s|S1(RlRmRnRR	R1RStTrue(Rtndtype((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_has_nested_dtype�s-cCsEt}tt|�tjt��d}tt|�tjddg��tt|dd�tjddg��d}tt|d
d�tjd d!g��d}tt|d
d�tjd"d#g��d}tt|d
d�tjd$d%g��tt|d
ddd�tjd&d'g��dtfdtfg}tt|�tjdtfdtfg��tt|d
d�tjdtfd
tfg��tt|d
d�tjdtfdtfg��tt|d
d�tjdtfd
tfg��tttf}tt|�tjdtfdtfdtfg��tttf}tt|d
d�tjdtfd
tfdtfg��tjt�}tt|d
d�tjgd(D]}|tf^q���tjt�}tt|d
dddgdd�tjgd)D]}|tf^q%��dS(*sTest ndtype on dtypessi4, f8R>ti4R?tf8RDs
field_%03it	field_000t	field_001R2sa, bR&R'sa, b, cs, bsf%02itf00R%R+sa,bsa,b,cR@R(Rtf01tf02N(sf0R�(sf1R�(R�R�(R�R�(R&R�(R'R�(R&R�(R'R�(sf0R�(R'R�(R&R�(R�R�(R&R'R((R�R�R�(RnRR
RlRmRS(RR~t_((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_easy_dtype�sL."""++)!cCsAtjd
dg�}t|�}t|ttg�tjdddgfdtfg�}t|�}t|tjd�tjd�tg�tjdtdffdtd	ffg�}t|�}t|ttg�t|t�}t|tgdtgd	�tjddg�}t|�}t|ttg�dS(sTesting flatten_dtypeR&R�R'taas|S1tabs|S2iiR%R+N(R&sf8(R'sf8(R�s|S1(R�s|S2(R&R%((R&R%sf8(R'R+((R'R+sf8(RlRmRRRnRSR}(Rtdttdt_flat((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyttest_flatten_dtype1s'(-(R!R"RR�R�(((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyRz�s			9t__main__(RLRMtioRRtdatetimeRRNtnumpyRltnumpy.lib._iotoolsRRRR	R
Rt
numpy.testingtnumpy.compatRR
tTestCaseRR$RQRRRzR!trun_module_suite(((sC/usr/lib64/python2.7/site-packages/numpy/lib/tests/test__iotools.pyt<module>s".
@5	_Y