Current File : //opt/imh-python/lib/python2.7/test/test_struct.pyc
�
��Wc
@sOddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlZejdkZ
ejdkZdddd	d
ddd
ddf
Zejje�ddZyejdd�Wnejk
r�eZnXeZd�Zd�Zdejfd��YZd�ZedkrKe�ndS(i����N(ttest_support(tcheck_warningstcheck_py3k_warningstbigi���tbtBthtHtitItltLtqtQis.pyicCsdjt|��S(Nt(tjointreversed(ts((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pytstring_reversescCstr
|St|�SdS(N(tISBIGENDIANR(tvalue((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pytbigendian_to_nativest
StructTestcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zed
�Z
eed�Zd�Zd
�Zd�Zd�Zd�Zd�Zejed�d��Zd�Zd�Zejd��Zd�ZRS(cCs�tdtf��}tj||�}WdQXtj�jd}|j|jt	�|j|j
|�|jt|j�d�tj|t
|��}|j||�dS(Ns&.*integer argument expected, got floati(RtDeprecationWarningtstructtpacktinspecttcurrentframetf_linenotassertEqualtfilenamettestmod_filenametlinenotlentwarningstint(tselftformattnumbertwtgotR texpected((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pytcheck_float_coerce$scCs0|jtjdd�dtd�kt�dS(Ns=iii(RRRtchrR(R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_isbigendian1scCsr|jtjtjd�tjd�}|j|dtjd��d}d}tj|�}tj|�}|j|d|�|jtjtjdd�|jtjtjdddd�|jttjftjdd�|jttjftjdd�|jtjtjd	d
�tjddd
�}|jtjtjd|�|jtjtjd|�dS(NtZRitiiiscbxxxxxxhhhhiillffd?s3c3b18x12h6i6l6f3d3?tfootPtdtflaptiiii(tassertRaisesRterrortcalcsizeRRt	TypeErrortunpack(R$tsztfmttfmt3tsz3R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_consistence4s """cCsYd}d}d}d}d}d}d}t}x"dD]}	xdD]	}
|	|
}
tj|
||||||||�	}tj|
|�\}}
}}}}}}|j||�|j|
|�|j||�|j||�|j||�|jtd|�td|��|jtd|�td|��|j||�qDWq7WdS(Ntaii�i��igo���!	@Rt@t<t>t=t!s	xcbhilfd?s	xcBHILfd?id(RR?R@RARBRC(s	xcbhilfd?s	xcBHILfd?(tTrueRRR8RR#(R$tcRRRR
tfR1tttprefixR%Rtcptbpthptiptlptfptdpttp((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_transitivenessIs*


'*$$c'Cs�dEdFdGdHdIdJdKdLdMdd
d
dNd
dOdfdPdQdRdSdTdUdVd$dWd"d#dfdXdYdZd-d[d+d,dfd\d]d^d1d_d+d,dfd`dadbdcddded>td@d@dfd>gdddfd>dfd@d@dfg#}x�|D]�\}}}}}x�dA||fdB||fdC||fdD|tr9|p<|fgD]\}}tj||�}	|j|	|�|jtj|�t|	��tj||	�d}
|
|krC|j|�qCqCWq�WdS(gNRER>itxctatcxtaRt0st
helloworldRit1sRt9st	helloworlt10st11sthelloworldt20si
tRisi����s�Ri�i�s�s�iD���s�DsD�RiRi�,s,�s�,i���s���s���R	l�XlR
RRFg@s@t@R1s@t@g�s�t�s�t�t?isRARCR@RB(RER>R>R>i(RRR>RSRSi(RTR>RURUi(RR>R>R>i(RVRWRRi(RXRWRRi(RYRWRZRZi(R[RWRWRWi(R\RWR]R]it
Re(Rissi(Ri����s�s�i(Rissi(Ri�s�s�i(Ri�s�s�i(RiD���s�DsD�i(Ri�s�s�iiD�(Ri�,s,�s�,i(Ri���s���s���i(R	l�Xs,�s�,il�b�w(R
i�,s,�s�,i(R
i���s���s���i(Rl�Xs,�s�,il�b�w(RFg@s@R`i(R1g@s@Rai(RFg�s�Rbi(R1g�s�Rci(Rdissi(Rdissi(i(	RDRRRRR6R!R8t
assertTrue(R$ttestsR:targRtliltasytxfmttexptrestrev((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_new_featuresas\*)c	Cs�i
dd6dd6dd6dd6dd6dd	6dd
6dd6dd
6dd6}xLtD]D}x;dD]3}||}tj|�}|j|||�q`WqSWxcdD][}xRddgD]D}tj||d�}tj||d�}|j||�q�Wq�W|jtjd�d�|jdtjd��|jdtjd
��|jtjd�tjd��|jtjd�tjd
��tr�|jtjd
�tjd��|jdtjd
��|jtjd
�tjd
��ndS(NiRRiRRiRR	R
RiRR
RBR@RARCtbBthHtiItlLRR?i(RBR@RARC(RpRqRrRs(t
integer_codesRR6RtassertLessEqualtHAVE_LONG_LONG(	R$t
expected_sizetcodet	byteorderR%tsizetformat_pairtsigned_sizet
unsigned_size((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt
test_calcsize�s2



"""cs�ddl�dtjf���fd��Y�d}xdtD]\}xS|D]K}|d
krv|dkrvtrvqKn||����}|j�qKWq>WdS(Ni����t	IntTestercsAeZ�fd�Zejej�jd�Z�fd�ZRS(cs&t�|�jdd�||_|d|_|d |_|jdkratd
|j��ntj|�|_|jd|_	|jt
d�kr�t|_d
|j	d|_
d
|j	dd|_nQ|jt
d�krt|_d|_
d
|j	d|_ntd|j��dS(Nt
methodNamettest_onei����RR?RBR@RARCs"unrecognized packing direction: %sitbhilqlitBHILQisunrecognized format code: %s(RR?RBR@RARC(tsupert__init__R%Rxt	directiont
ValueErrorRR6tbytesizetbitsizettupleRDtsignedt	min_valuet	max_valuetFalse(R$R%(R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR��s&	

			c	Ss�|j}|j|ko&|jknrst|�}|jr`|dkr`|d|j>7}n|j|d�d|}t|�d@r�d|}n||�}d|jt|�|}|j	dks�|j	dkr�t
r�t|�}n|jt|�|j�|||�}|j||�|||�d}|j||�|j
tjtf||d|�n"|j
tttjf|||�dS(
Nils%xit0R_R@RR?RBs(RR?RB(R%R�R�tlongR�R�tassertGreaterEqualR!R�R�RRRR4RR5R7t
OverflowErrorR�(	R$txRR8t	unhexlifyR%R)R(t	retrieved((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR��s0	"

cs�ddlm}g}x,t|jd�D]}|jd|>�q*WxXt|j�D]G}d}x+t|j�D]}|d>|d�B}qqW|j|�qUW|jdd	tjd
g�xg|D]_}xV||fD]G}x>d"D]6}||}	|j	t
|	��|j	t|	��q�Wq�Wq�Wd
tfd��Y}
dd#d��Y}dtfd��Y}dtfd��Y}
|j
ttjftj|jd�|j
ttjftj|j|�tdtf��7|j
ttjf��tj|jd$�WdQXWdQXx�|
�|�|
�fD]�}tdtf��}tj|j|�}WdQXtj�jd}|j|jt�|j|j|�|jt|j�d�tj|jt
|��}|j||�q*Wxo|d�|d�|d�|d�|d�|d�fD]1}ytj�|�Wq|jd�qXqWxp|d�|d �|d�|idd6�|dd!dg�fD]+}|j
ttjftj|j|�q�WdS(%Ni����(t	randrangeilliii,i`�
iiit
NotAnIntNScBseZd�Zd�ZRS(cSsdS(Ni*((R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt__int__scSsdS(Nl�((R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt__long__s(t__name__t
__module__R�R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�s	t
NotAnIntOScBseZd�Zd�ZRS(cSsdS(NiU((R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR� scSsdS(Nl�����((R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�#s(R�R�R�R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�s	t	IndexablecBseZd�Zd�ZRS(cSs
||_dS(N(t_value(R$R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�*scSs|jS(N(R�(R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt	__index__-s(R�R�R�R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�)s	tBadIndexcBseZd�Zd�ZRS(cSs
t�dS(N(R7(R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�3scSsdS(Ni*((R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�6s(R�R�R�R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�2s	sa strings*integer argument expected, got non-integeryE@s,.*integer argument expected, got non-integeri
ii*idis:integer code pack failed on object with '__index__' methodR>ubi(i����ii(y@E@( trandomR�trangeR�tappendR�textendtsystmaxintR�R#R�tobjectR4R7RR5RR%RRRRRRRRR R!R"tfailtNone(R$R�tvaluesRlRtvaltjtbasetincrR�R�R�R�R�tnonintR'R(R R)tobj(R%(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pytrun�sf



	
%,(	R�R�R�RRR8R�R�R�((RtbinasciiR%(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�s
#RR?RBR@RARCRR
(RR?RBR@RARC(RR?(RR
(R�tunittesttTestCaseRtRvR�(R$t
byteordersRxRyRG((RR�R%si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt
test_integers�s%�


cCs�x�dddddddddddddddfgD]Y\}}}}tj||�}|j||�tj||�\}|j||�q;WdS(NtptabcR_Rt1pt2psaR>t3psabtabt4psabct5psabct6psabct1000pR�i�s�i�i�(R�R�sR(R�R�sR(R�R�saR>(R�R�sabR�(R�R�sabcR�(R�R�sabcR�(R�R�sabcR�(RRRR8(R$RxtinputR)texpectedbackR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_p_codels5c	Csfddl}x�tdd�D]�}d}x"||d|krL|d:}q+W||}tjd|�}tjd|�d}|j||�tjd|�}|j|t|��tjd|�d}|j||�qWd}|j|d�}tjd|�}tjd|�d}|j||�d}|j|d�}|jt	tjd|�dS(Ni����ii!g�?g@s<fis>fiiiiii���ihii���ig(
tmathR�RRR8RRtldexpR4R�(	R$R�R�tdeltatsmallertpackedtunpackedt	bigpackedR((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_705836|s*
cCsNxGdD]?}x6tD].}|j||d�|j||d�qWqWdS(NRRAR@g�?g�?(RRAR@(RtR*(R$tendianR:((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_1530559�s

cCs'|d�}d}tj|�}|j|j|�d�|jtj||�d�xktd�D]]}|j|j||�|||d!f�|jtj|||�|||d!f�qcWx\tdt|�d�D]A}|jtj|j||�|jtjtj|||�q�WdS(	Nt	abcd01234t4stabcdiii(R�(R�(RtStructRtunpack_fromtxrangeR!R4R5(R$tclstdataR:RR((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_unpack_from�s*1 c
Cs.d}|dd�}d}tj|�}|j|d|�||�t|� }|j||�|j|d|�||�t|�d }|j||d |�|d	�}|jttjf|j|d|�|jttjf|j|d|�|}	|jttjftjd|	d�dS(
NsReykjavik rocks, eow!t idt21sii
iRs
          (
RR�t	pack_intoR!RR4R�R5R7R�(
R$R�ttobytesttest_stringtwritable_bufR:Rtfrom_buft	small_buftsb((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_pack_into�s$cCs#|jdd�dtjj�dS(NR�cSstjd|�S(NRE(tarray(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt<lambda>�sR�(R�R�ttostring(R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_pack_into_array�scCs |jdd�dtj�dS(NR�cSstt|��S(N(t
memoryviewt	bytearray(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR��sR�(R�R�R�(R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_pack_into_memoryview�scsd}tjddd�}d��fd�}||d|�|j�t|� }|j||�||d|�|j�t|�d }|j||d |�tjdd
�}|jttjf||d|�|jttjf||d	|�dS(NsReykjavik rocks, eow!RER�idR�cstj�|�S(N(RR�(targs(R:(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR��sii
is
          (R�R�R!RR4R�RR5(R$R�R�R�R�R�((R:si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_pack_into_fn�scCs�tdtf��utjdd�}tddd�}x9||gD]+}tjd|�\}|j|d�qDW|jd	t�WdQXdS(
Nsbuffer.. not supported in 3.xRs4Vxs......4Vx......iis>IixV4R�(RRR�tbufferRR8RR�(R$tdata1tdata2R�R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_unpack_with_buffer�s
cCsYtd�}x6|gD]+}tjd|�\}|j|d�qW|jdt�dS(Ns4Vxs>IixV4R�(R�RR8RR�(R$R�R�R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_unpack_with_memoryview�s
cCsdtfd��Y}x�td�dD]�}dggddf}dgddd	ddf}|d
t|�}tj||�}tj||�}|d
t|�}tj||�}	tj||	�}
|jt|�t|
��|jt|�t|��x|D]}|j|�qWx|
D]}|j|�q*Wtj|d
d�}|jt|�tj	|d
��t|�dkr�|j|dd|�n|j
ttj|d
|��q'Wx:dddddgD]#}
|jtjd|
�d�q�WdS(Nt
ExplodingBoolcBseZd�ZRS(cSs
t�dS(N(tIOError(R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt__nonzero__s(R�R�R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR�ss<>!=Riittestii����l��I����iRdtmsgs encoded bool is not one byte: %rsss�ss�s>?(R(li���(R�R�R!RRR8RtassertFalseRfR6R4R�(R$R�RHtfalsettruetfalseFormattpackedFalset
unpackedFalset
trueFormatt
packedTruetunpackedTrueRGR�RE((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt	test_bools2

#sSpecific to 32bit machinescCs|jttjdd�dS(Nt
357913941cR>(R4tMemoryErrorRR(R$((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_crasher*scCsldjtjd�}|jtjtj|�djtjdtjd�}|jtjtj|�dS(Ns{}bis{}b{}Hi(R%R�tmaxsizeR4RR5R6(R$t	hugecountt
hugecount2((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_count_overflow.s cCsJtjd�}|tjd�|d7}tj|tj|�|�dS(Nt5Pt3Pi(tsupporttcalcobjsizeRR6tcheck_sizeofR�(R$t
format_strtnumber_of_codest	totalsize((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR	5scCs�xtD]}|j|d�qW|jdd�|jddd�|jdd�|jdd	�|jd
d�|jdd�|jd
d�|jdd�|jdd	�dS(Nit	BHILfdspPi	Ri�tfditxxxxxxxxxxxxxxit100Hidt187st20pRVt0c(RtR	(R$Rx((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest__sizeof__<s
cCs�ytWntk
r(|jd�nXtjttd���}|j|jd�|j	t
|j�t�|jt
tjtd��dS(Nsno unicode supportR	i�(tunicodet	NameErrortskipTestRR�tunichrtordRR%tassertIsttypetstrR4R�(R$R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyttest_unicode_formatJs
( R�R�R*R,R=RQRoR~R�R�R�R�RR�R�R�R�R�R�R�R�R�R�t
skipUnlesstIS32BITRRR	Rtcpython_onlyRR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyR"s.	
				5	$	�		#							&		cCstjt�dS(N(Rtrun_unittestR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt	test_mainVst__main__( tosR�R�RRR�RRttest.test_supportRRR�RyRRRRttpathtsplitextt__file__RRR5R�RvRDRRR�RR"R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_struct.pyt<module>s0$
		��6