%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyc

�
�9Zc@`srdZddlmZmZmZddlZddlZddlZddl	j
Z
ddlmZddlm
Z
mZddl	mZmZddlmZmZmZddlmZmZdd	lmZmZmZmZmZmZdd
lm Z m!Z!m"Z"defd��YZ#d
efd��YZ$defd��YZ%d�Z&e'dkrne�ndS(s^Tests suite for mrecords.

:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu

i(tdivisiontabsolute_importtprint_functionN(trecarray(tasbytestasbytes_nested(tmaskedtnomask(tTestCasetrun_module_suitettemppath(tfromrecordst
fromarrays(t
MaskedRecordst	mrecarrayRtfromtextfileRtaddfield(tassert_tassert_equaltassert_equal_recordstTestMRecordscB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�ZRS(cO`s!tj|||�|j�dS(N(Rt__init__tsetup(tselftargstkwds((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyR"scC`s�dddddg}dddd	d
g}tddd
ddg�}dtfdtfdg}dddddg}tjtt|||��d|d|�|_dS(Niiiiig�������?g������@gffffff
@g������@g@tonettwotthreetfourtfivetatbtcs|S8itmasktdtype(R!s|S8(Rtinttfloattmatarraytlisttziptbase(RtilisttflisttslisttddtypeR"((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyR&scC`s�|j}|jt�}t|j|j�t|j|j�tt|j	t
��t|j	|j	jt
��x#dD]}t||||�qwWt|jt�|�dS(NRR R!(RR R!(R*tviewRRt
recordmaskRt_maskRt
isinstancet_dataR(RR*tmbasetfield((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_byview0s	
cC`sg|jj�}|jt�}x=dD]5}tt||�||�t||||�q%W|d}tt|t��t|j|j�t|j	�ddt
d�f�t|jt�t|j
j�tttf�t|d|dd�|d}tt|t��t|j|j�t|j	�d�t|jt�t|j
j�tttf�t|d|dd�t|dtk�|d	 }tt|t��t|j|j�t|jddg�t|jtjtttftttfgd
|j
j��t||d	 jt��x,d
D]$}tt||�|d	 |�q;WdS(NRR R!iig�������?Ri����iR#(RR R!(NNN(RR R!(R*tcopyR/RRtgetattrRR2R#ttolistRR0RR1titemtFalsetNonetTrueRRR"tnpR'(RR*R4R5tmbase_firstt
mbase_lasttmbase_sl((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_get<s>

"

	
c
C`s5|jj�}|jt�}|j�}d|_d|jj(t|djdddddg�t|djdddddg�d|_t|djdgd�tt	j
|d�dgd�t|jtgd�t|jj
�tjdddddgdt��t|_t|jjdgd�t|jjdgd�tt	j
|d	�dgd�tt	j|d	�td�gd�t|jj
�tjdddddgdt��|jt�j�}d|jd
)t|jddd
ddg�t|jjdddddg�t|jd
)t|j|d�t|jjdddddg�d dtfg}t	jd!d"d#gd|�}|jt�}t	jdddgddddg�}tj��Htjd�||d<t|j|�t|jjdddg�WdQXdS($Ni?Bg@��x�DsN/AiRiiR#R!iiR talphas|S1tnumi
iiR"tignore(i?Bg@��x�DsN/A(iii(iii(iii(iii(iii(iii(iii(iii(iii(iii(RCs|S1(Ri(R i(R!i(R*R7R/Rt
fill_valueRR3RR1R&tgetmaskarrayR0R;R9R>R'tboolRR!R"tgetdataRR R$R
twarningstcatch_warningstsimplefilterRD(RR*R4tndtypetdatatrdatatval((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_set_fieldsds\	
##	!		
	!'		

"
"'


cC`s�|jj�}|jt�}t|dd<t|jdddddg�t|jjdddddg�tt	j
d�t	jjd�gd	dt
fd
tfg�}t|dd<t|jdddddg�t|jjdddddg�dS(NRi����iiiiiiR#R (R*R7R/RRRRR1RR>tarangetrandomtrandR$R%(RR*R4((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_set_fields_mask�s"$cC`s|jj�}|jt�}t|_ttj|d�dgd�t|dj	|dj	�t|dj	|dj	�t|j	j
�tjdgddt
��t|_ttj|d�dgd�t|j	j
�tjd	gddt
��dS(
NR iiRR!R#i(iii(iii(R*R7R/RRR"RR&RGR1R9R>R'RHR(RR*R4((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyt
test_set_mask�s	!	!cC`s|jj�}|jt�}dddddg|_t|jjdddddg�t|jjdddddg�t|jjdddddg�dddddg|_t|jjdddddg�t|jjdddddg�t|jjdddddg�dS(Nii(	R*R7R/RR"RRR R!(RR*R4((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_set_mask_fromarray�s"""""cC`sB|jj�jt�}tjddd	d
dgddtfdtfdtfg�}||_t|j	jdddddg�t|j
jdddddg�t|jjdddddg�t|_||_
t|j	jdddddg�t|j
jdddddg�t|jjdddddg�dS(NiiR#RR R!(iii(iii(iii(iii(iii(R*R7R/RR>R'RHR"RRR R!R;t	fieldmask(RR4tnmask((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_set_mask_fromfields�s$	"""		""c
C`sg|jj�}|jt�j�}t|d<t|jj�tj	dddddgdt
��t|jdddddg�|jt�j�}d|d*t|jj
dddddg�t|jjdddddg�t|jj
d	d	d
ddg�t|jjdddddg�t|jj
td
d
dddg��t|jjdddddg�|jt�j�}t|d*t|jj
dddddg�t|jjdddddg�t|jj
ddd
ddg�t|jjdddddg�t|jj
tdddddg��t|jjdddddg�dS(Ni����iiR#iiiig@gffffff
@g������@g@t5RRRg�������?g������@RR(iii(iii(iii(iii(iii(iii(R*R7R/RRRR1R9R>R'RHR0RR3R R!R(RR*R4((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_set_elements�s4


"""""
""""cC`sa|jj�}|jt�}|j�y�d|d)t|jjdddddg�t|jjddddd	g�t|j	jt
d
ddd
dg��t|jjdddddg�t|jj|jj�t|jj|j	j�Wn$tk
r	n t
k
r�n
Xtd��yd|d)Wnttfk
rPn
Xtd��dS(Nii����iiig�������?g������@gffffff
@g@RRRR[Ris)Flexible hard masks should be supported !s.Should have expected a readable buffer object!(iii(R*R7R/Rtharden_maskRRR3R R!RR1tNotImplementedErrortAssertionErrort	Exceptiont	TypeError(RR*R4((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_setslices_hardmask�s,

"""

cC`s�|jj�}|jt�}|j�|j|j�t|_t	|j
|j
�|j�|j|j�t|_t	|j
tj
|j|j��|jtj|dj
�tk�t|dj
|dj
�dS(NR R(R*R7R/RR]t
assertTruet	_hardmaskRR"RR1tsoften_maskR&tmake_mask_nonetshapeR#t	make_maskR(RR*R4((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyt
test_hardmasks
	
		#cC`s�|jj�}|jt�}tj|�}tj|�}t|j|j�t	|j
|j
�t|j|j�t	|j|j�dS(N(R*R7R/RtpickletdumpstloadsRR#RR3R1(RR*tmrect_tmrec_((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyt
test_pickling)scC`s3tjdddgddddgdt�}tjddd	gddddgdt�}tjd
ddgddddgdd
�}dtfdtfdg}t|||gd|dd�}|j�}t|dtjddt��t|dtjddt��t|dtjddd
��dS(NiiiR"iR#g�������?g������@gffffff
@RRRs|S8RR R!RFi��g�i�@sN/A(R!s|S8(i��g�i�@sN/A(iii��(g�������?g������@g�i�@(RRsN/A(R&R'R$R%RtfilledRR>(Rt_at_bt_cR.Rmt
mrecfilled((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_filled4s---	 
cC`stjdddgddddgdt�}tjddd	gddddgdt�}tjd
ddgddddgdd
�}dtfdtfdg}t|||gd|dd�}t|j�dddtd�fddtd�fg�dS(NiiiR"iR#g�������?g������@gffffff
@RRRs|S8RR R!RFi��g�i�@sN/A(R!s|S8(i��g�i�@sN/A(ig�������?N(	R&R'R$R%RRR9R<R(RRrRsRtR.Rm((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_tolistCs---	cC`s?tddtdd�}d|dd<t|ddd�dS(NitformatstnamesR*i
i(RR%R(Rtx((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_withnamesPscC`stdddtfddtfg�}t|d<t|jd�j�dtd�d	f�tddd
ddfg�}t|d<t|jd�j�tj	dd|j
�j��tddd
�}t|d<d|d<|jd�t|jd�tj	ddgd|j
��dS(NiR#titss|S8tfit1g�?tf0s<f8isi4, (2,3)float, float(R}s|S8(ii(i(iii(iii(iii(RR$R%RRRqR:RR>R'R#R(Rteasytsolotmult((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_exotic_formatsVs'
+



(t__name__t
__module__RRR6RBRQRURVRWRZR\RbRiRpRvRwR{R�(((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyR s"		
		(	9					 					
	tTestViewcB`s,eZd�Zd�Zd�Zd�ZRS(cC`s�tjd�tjjd�}}dtjfdtjfg}tjtt||��d|�}t||gd|dd	�}t	t
f|jd<||||f|_dS(
Ni
RR R#RFg"�g�X�i(g"�g�X�(
R>RRRSRTR%R'R(R)RR;R=R"RN(RRR RMtarrRm((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pytsetUpls"$cC`s[|j\}}}}|j�}|jt|t��t||�t|j|j�dS(N(RNR/RcR2R
RR1(RRmRR R�ttest((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_view_by_itselfus

cC`s�|j\}}}}tjdf}|j|�}|jt|tj��t|tj	t
t||��dtj��|j|dtjk�dS(NiR#ii(ii(
RNR>R%R/RcR2R&tMaskedArrayRR'R(R)R(RRmRR R�tntypeR�((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_view_simple_dtype|s.cC`s�|j\}}}}dtjfdtjfg}|j|�}|jt|t��t||j|��|j|ddtk�t	|j
tj
|��|j|jdk�dS(NtAtBi(
RNR>R%R/RcR2R
RRRR#t_fill_valueR<(RRmRR R�talttypeR�((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_view_flexible_type�s(R�R�R�R�R�R�(((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyR�js				tTestMRecordsImportcB`sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cO`s!tj|||�|j�dS(N(RRR(RRR((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyR�sc	C`s'tjdddgddddgdt�}tjddd	gddddgdt�}tjtttd
ddg��ddddgdd
�}dtfdtfdg}t|||gd|dtd�td�td�f�}t|j	|j	|j	fd|�}|||f|_
dS(NiiiR"iR#g�������?g������@gffffff
@RRRs|S8RR R!RFt99999s99999.sN/A(R!s|S8(R&R'R$R%R(tmapRRt
recfromarraysR3RN(RRrRsRtR.Rmtnrec((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyR�s--$$c
C`s)tjdddgddddgdt�}tjddd	gddddgdt�}tjd
ddgddddgdd
�}|j\}}}xBtd|||f�D](\}}tt||�j|j�q�Wtjddd
gddddg�}	t	t
|	d|j�|d�dS(NiiiR"iR#g�������?g������@gffffff
@RRRs|S8RR R!(RR R!(R&R'R$R%RNR)RR8R1RRR#(
RRrRsRtRmR�RnR~tlt_x((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_fromarrays�s---% 'cC`su|j\}}}dddg}t|d
d�}t|d
d�}t||�t|�}t|j|j�x6|jjD](}tt||�t|j|��q~Wt|j	�d
d�}t|jd
t
fdtfdg�x?tdd�D].\}	}
tt||	�t|j|
��q�Wt|�}t|j|j�t|j|j
��t|j|j�dS(Nitabcg���
@iitxyg���@t g����?Rysc1, c2, c3, c4sc1,c2,c3tc1tc2tc3s|S5RR R!(iR�g���
@i(iR�g���@i(iR�g����?i(R�s|S5(R�R�R�(RR R!(RNtrecfromrecordsRRRR#RyR8R3R9R$R%R)RqR1(RRmR�R.tpalisttpatmpat_mrecR5R~tn((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_fromrecords�s&	
&%&cC`sk|j\}}}t|j�d|ddddg�}t|j|j�t|jj�dddg�t|j�d|dt�}t|j|j�t|jj�dd	d
g�t|j�d|d|j�}t|j|j�t|jj�|jj��t|j�d|d|jj��}t|j|j�t|jj�|jj��dS(NR#R"ii(iii(iii(iii(iii(iii(iii(RNRR9RR3RR1R=(RRmR�R.R�((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_fromrecords_wmask�s'!cC`s�d}t��D}t|d��}|j|�WdQXt|dddd�}WdQX|jt|t��t|jddddg�t|j	j
ddddg�t|jddd	d
g�dS(Ns�#
'One (S)','Two (I)','Three (F)','Four (M)','Five (-)','Six (C)'
'strings',1,1.0,'mixed column',,1
'with embedded "double quotes"',2,2.0,1.0,,1
'strings',3,3.0E5,3,,1
'strings',4,-1e-10,,,1
twt	delimitort,tvarnamestABCDEFGiig�OAg�����|۽(R
topentwriteRRcR2R
RtFtER1tC(RtfcontenttpathR~tmrectxt((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyttest_fromtextfile�s	cC`sv|j\}}}dddgdddg}}t|tj|d|��}t|j|�t|jj|�dS(Nidi�i,iiR"(RNRR&R'Rtf3R1(RRmR�R.tdtm((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyt
test_addfield�s
(	R�R�RRR�R�R�R�R�(((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyR��s		
				cC`sHtjd
dgddd
gddtfd	tjfg�}|ddS(Nit2it4R"iR#RR (iR�(iR�(ii(ii(R&tmasked_arrayR$R>tobject(ty((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyt#test_record_array_with_object_field�s
t__main__((t__doc__t
__future__RRRRJRjtnumpyR>tnumpy.maR&Rtnumpy.compatRRRRt
numpy.testingRR	R
tnumpy.core.recordsRR�RR�tnumpy.ma.mrecordsR
RRRtnumpy.ma.testutilsRRRRR�R�R�R�(((sO/opt/alt/python27/lib64/python2.7/site-packages/numpy/ma/tests/test_mrecords.pyt<module>s&.�K&i	


Zerion Mini Shell 1.0