Current File : //opt/imh-python/lib/python2.7/test/test_memoryview.pyc
�
��Wc@sqdZddlZddlZddlZddlZddlZddlmZddlZddl	Z	ddl
Z
ddd��YZdefd��YZddd	��YZ
d
dd��YZddd
��YZdeje
efd��YZdejeefd��YZdejeefd��YZdejfd��YZd�Zedkrme�ndS(sTUnit tests for the memoryview

XXX We need more tests! Some tests are in test_bytes
i����N(ttest_supporttAbstractMemoryTestscBs�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�ZRS(tabcdefcCs|jS(N(tsource_bytes(tself((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt_sourcescCstd|j|jg�S(N(tfiltertNonetro_typetrw_type(R((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt_typesscs�|j}||j�}tj|�}|j|��|j�d|d��|j�dt�|j�d|d��|j�d|d��|j�d|d��|jt	�fd��|jt	�fd��|jt	�fd	��|jt	�fd
��|jt
�fd��|jt
�fd��|jt
�fd
��d�|jtj|�|�dS(Nitaitfi����i����cs�dS(Ni(((tm(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt<lambda>'scs�dS(Ni����(((R
(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR(scs�tjS(N(tsystmaxsize((R
(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR)scs�tjS(N(RR((R
(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR*scs�dS(N(R((R
(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR,scs�dS(Ng(((R
(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR-scs�dS(NR(((R
(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR.s(tgetitem_typeRRtgetrefcountt_viewtassertEqualtassertIsInstancetbytestassertRaisest
IndexErrort	TypeErrorR(Rttptitemtbtoldrefcount((R
sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pytcheck_getitem_with_types$	cCs%x|jD]}|j|�q
WdS(N(R
R(RR((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_getitem2scCsoxh|jD]]}||j�}|j|�}|jt|�gtt|��D]}||^qP�q
WdS(N(R
RRRtlisttrangetlen(RRRR
ti((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt	test_iter6scCsLxE|jD]:}||j�}|j|�}|j|j�t�q
WdS(N(R
RRRt__repr__tstr(RRRR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt	test_repr<scs�|js|jd�n|j|j�}tj|�}|j|���fd�}|jt|d�|jt|d�|jt|td��d�|j
tj|�|�dS(Nsno read-only type to testcs|�d<dS(Ni((tvalue(R
(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pytsetitemHsRiA(RtskipTestRRRRRRt
memoryviewRR(RRRR)((R
sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_setitem_readonlyBs	cs||js|jd�n|j�|j|j�}tj|�}|j|���d��d<|j�|d��d��dd+|j�|d��d	��dd+|j�|d��d
��(|j�|d
��dd!�dd+|j�|d
��d
��(�dd!�dd+|j�|d���fd�}|jt|dd�|jt|dd�|jt|tj	d�|jt|tj	d�|jt
|dd�|jt
|dd�|jt
|dd�|jt|dd	�|jt|dd�|jt|tdd�d�|jt|tdd�d�d�|jtj|�|�dS(Nsno writable type to testt0it0bcdeft12iit012deftRiitcdedeftababcfcs�|��|<dS(N((tkeyR((R
R(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR)gsiRi����gtab(i(R	R*RRRRt_check_contentsRRRRt
ValueErrortsliceRR(RRRR)((R
Rsm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_setitem_writablePsB		

c	Cssxl|jD]a}||j�}|j|�}|jt��|d=WdQX|jt��|dd5WdQXq
WdS(Nii(R
RRRR(RRRR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_delitem{s
cs{xt�jD]i}�j|�j��}|j�}dj�fd�dD��}�j||��j|t�q
WdS(NR1c3s|]}�j|�VqdS(N(R(t.0tc(R(sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pys	<genexpr>�sR(R
RRttobytestjoinRRR(RRR
Rtexpected((Rsm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_tobytes�scCsUxN|jD]C}|j||j��}|j�}|j|ttd��q
WdS(NR(R
RRttolistRtmaptord(RRR
tl((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_tolist�scCs�x{|jD]p}|j||j��}x�|jD]�}|j||d�k�|j||d�k�|j||d�k�|j||d�k�|j||d�k�|j||d�k�q2W|j||k�|j||k�|j|dd!|k�|j|dd!|k�|j|dk�|j|dk�|jd|k�|jd|k�q
WdS(NRtabcdetabcde1iiiuabcdef(R
RRt
assertTruetassertFalse(RRR
ttp_comp((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_compare�s"cCs�|j||j��}|j|j|j�|j|jt�|j|j|j�|j|jd�|j|jd�|jt	|�d�|j|j
|jf�|j|jd�|S(Nii(i(
RRRtformatRR&titemsizetndimtshapeR"tstridest
suboffsetsR(RRR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pytcheck_attributes_with_type�scCsB|js|jd�n|j|j�}|j|jt�dS(Nsno read-only type to test(RR*RRRtreadonlytTrue(RR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_attributes_readonly�s	cCsB|js|jd�n|j|j�}|j|jt�dS(Nsno writable type to test(R	R*RRRRStFalse(RR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_attributes_writable�s	cCs�x�|jD]�}t|t�s%q
nd|fd��Y}ddd��Y}||d��}|j|�}|�}||_||_tj|�}d}}}t	j
�|j|�dk|��q
WdS(NtMySourcecBseZRS((t__name__t
__module__(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRX�stMyObjectcBseZRS((RYRZ(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR[�stabc((R
t
isinstancettypeRR
totweakreftrefRtgctcollectRH(RRRXR[RR
R_twr((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_gc�s			
cCsl|j}|dkr%|jd�n||j�}|j|�}tjd�}|jt|j	|�dS(Nsno read-only type to testtZZZZ(
RRR*RRtiotBytesIORRtreadinto(RRRR
R#((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_writable_readonly�s	(RYRZRtpropertyRR
RRR$R'R,R9R:R@RERKRRRURWReRj(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRs$						+			
						tBaseBytesMemoryTestscBs&eZeZeZeZdZdZRS(itB(	RYRZRRt	bytearrayR	RRMRL(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRl�s
tBaseMemoryviewTestscBseZd�Zd�ZRS(cCs
t|�S(N(R+(Rtobj((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRscCs|j|||��dS(N(R(RRRptcontents((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR6s(RYRZRR6(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRos	tBaseMemorySliceTestscBs)eZdZd�Zd�Zd�ZRS(tXabcdefYcCst|�}|dd!S(Nii(R+(RRpR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR"scCs!|j|dd!||��dS(Nii(R(RRRpRq((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR6&scCs`xY|jD]N}t||j��}tj|�}|dd!|jtj|�|�q
WdS(Nii(R
R+RRRR(RRR
R((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt	test_refs)s
(RYRZRRR6Rt(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRrs		tBaseMemorySliceSliceTestscBs eZdZd�Zd�ZRS(RscCst|�}|d dS(Nii(R+(RRpR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR3scCs!|j|dd!||��dS(Nii(R(RRRpRq((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR67s(RYRZRRR6(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRu0s	tBytesMemoryviewTestcBseZd�ZRS(cCs�x�|jD]�}||j�}|jt|��|jtd|��|jtt�|jtt||�|jttd|�|jtt|dt�q
WdS(Ntobjecttargument(R
RRHR+RRRT(RRtob((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyttest_constructor@s(RYRZRz(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyRv=stBytesMemorySliceTestcBseZRS((RYRZ(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR{VstBytesMemorySliceSliceTestcBseZRS((RYRZ(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR|^st	OtherTestcBseZd�ZRS(cCs3td�}|jt��tj|�WdQXdS(NR\(R+RRtcopy(RR
((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt	test_copyhs(RYRZR(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyR}gscCstjt�dS(N(Rtrun_unittestRY(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt	test_mainust__main__(((((t__doc__tunittestRRbR`tarrayttestRRgR~tpickleRRlRoRrRutTestCaseRvR{R|R}R�RY(((sm/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_memoryview.pyt<module>s0�