Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_iter.cpython-38.opt-1.pyc
U

>��g;�@sddlZddlZddlmZmZmZmZddlmZddlZddl	Z
dddddd	d
ddd
dddddddddddddddddgZGdd �d �ZGd!d"�d"�Z
Gd#d$�d$�ZGd%d&�d&�ZGd'd(�d(�ZGd)d*�d*�ZGd+d,�d,�ZGd-d.�d.ej�Zd/d0�Zed1k�r
e�dS)2�N)�run_unittest�TESTFN�unlink�cpython_only)�check_free_after_iterating)rrr)rr�)rr�)rrr)rrr�rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrrc@s$eZdZdd�Zdd�Zdd�ZdS)�BasicIterClasscCs||_d|_dS�Nr)�n�i��selfr�r�-/opt/cppython/lib/python3.8/test/test_iter.py�__init__szBasicIterClass.__init__cCs"|j}||jkrt�|d|_|S�Nr)r
r�
StopIteration�r�resrrr�__next__s


zBasicIterClass.__next__cCs|S�Nr�rrrr�__iter__#szBasicIterClass.__iter__N��__name__�
__module__�__qualname__rrrrrrrr
sr
c@seZdZdd�Zdd�ZdS)�IteratingSequenceClasscCs
||_dSr�rrrrrr'szIteratingSequenceClass.__init__cCs
t|j�Sr)r
rrrrrr)szIteratingSequenceClass.__iter__N�rrrrrrrrrr&src@seZdZdd�Zdd�ZdS)�
SequenceClasscCs
||_dSrr rrrrr-szSequenceClass.__init__cCs&d|kr|jkrnn|St�dSr)r�
IndexError�rr
rrr�__getitem__/szSequenceClass.__getitem__N)rrrrr%rrrrr",sr"c@seZdZdd�ZdS)�UnlimitedSequenceClasscCs|Srrr$rrrr%6sz"UnlimitedSequenceClass.__getitem__N�rrrr%rrrrr&5sr&c@seZdZdS)�DefaultIterClassN)rrrrrrrr(9sr(c@seZdZdd�ZdZdS)�NoIterClasscCs|Srrr$rrrr%=szNoIterClass.__getitem__N)rrrr%rrrrrr)<sr)c@seZdZdd�ZdS)�BadIterableClasscCst�dSr)�ZeroDivisionErrorrrrrrBszBadIterableClass.__iter__N�rrrrrrrrr*Asr*c@s�eZdZdudd�Zdvdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dBdC�Z#dDdE�Z$dFdG�Z%dHdI�Z&dJdK�Z'dLdM�Z(dNdO�Z)dPdQ�Z*dRdS�Z+e,dTdU��Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4ddde�Z5dfdg�Z6dhdi�Z7djdk�Z8e,dldm��Z9dndo�Z:dpdq�Z;drds�Z<dtS)w�TestCaseTcCsV|r|�||�g}zt|�}Wntk
r8YqFYnX|�|�q|�||�dSr)�check_pickle�nextr�append�assertEqual)r�it�seq�pickler�valrrr�check_iteratorJs
zTestCase.check_iteratorcCs<|r|�t|�|�g}|D]}|�|�q|�||�dSr)r.�iterr0r1)r�exprr3r4rr5rrr�check_for_loopWszTestCase.check_for_loopc	Cs�ttjd�D]�}t�||�}t�|�}|�t|tjj	��|�
t|�|�t�|�}zt|�Wnt
k
rzYqYnXt�||�}t�|�}|�
t|�|dd��qdSr)�ranger4�HIGHEST_PROTOCOL�dumps�loads�
assertTrue�
isinstance�collections�abc�Iteratorr1�listr/r)rZitorgr3�proto�dr2rrrr.`s



zTestCase.check_picklecCs |�ttd��ttd���dS�N�
)r6r7r:rCrrrr�test_iter_basictszTestCase.test_iter_basiccCs.ttd��}t|�}t|�}|�||k�dSrF)rCr:r7r>)rr3r2Zit2rrr�test_iter_idempotencyxszTestCase.test_iter_idempotencycCs |�ttd��ttd���dSrF�r9r7r:rCrrrr�test_iter_for_loopszTestCase.test_iter_for_loopcCsVtd�}g}t|�D]0}t|�D]"}t|�D]}|�|||f�q,q q|�|t�dS�N�)r:r7r0r1�TRIPLETS)rr3rr
�j�krrr�test_iter_independence�szTestCase.test_iter_independencecs.td���fdd�t��D�}|�|t�dS)NrMcs2g|]*}t��D]}t��D]}|||f�qqqSr)r7��.0r
rOrP�r3rr�
<listcomp>�s

�z<TestCase.test_nested_comprehensions_iter.<locals>.<listcomp>)r:r7r1rNrrrTr�test_nested_comprehensions_iter�s

�z(TestCase.test_nested_comprehensions_itercs*td���fdd��D�}|�|t�dS)NrMcs*g|]"}�D]}�D]}|||f�qqqSrrrRrTrrrU�sz;TestCase.test_nested_comprehensions_for.<locals>.<listcomp>)r:r1rNrrrTr�test_nested_comprehensions_for�sz'TestCase.test_nested_comprehensions_forcCs|�td�ttd���dSrF)r9rrCr:rrrr�test_iter_class_for�szTestCase.test_iter_class_forcCs |�ttd��ttd���dSrF)r6r7rrCr:rrrr�test_iter_class_iter�szTestCase.test_iter_class_itercCs|�td�ttd���dSrF)r9r"rCr:rrrr�test_seq_class_for�szTestCase.test_seq_class_forcCs |�ttd��ttd���dSrF)r6r7r"rCr:rrrr�test_seq_class_iter�szTestCase.test_seq_class_itercCs�td�}ttjd�D�]v}t|�}t�||f|�}t�|�\}}d|_|�t	|�t	|��|�
t|�ttd���t|�t�||f|�}t�|�\}}d|_|�t	|�t	|��|�
t|�ttdd���tdd�D]}t|�q�t�||f|�}t�|�\}}d|_|�t	|�t	|��|�
t|�ttdd���|�
tt|�t�||f|�}t�|�\}}d|_|�t|tjj��|�
t|�g�qdS)N�r�)r"r:r4r;r7r<r=rZassertIs�typer1rCr/�assertRaisesrr>r?r@rArB)rZorigrDZitorigrEr2r3r
rrr�#test_mutating_seq_class_iter_pickle�s6
z,TestCase.test_mutating_seq_class_iter_picklec
Csvtd�}t|�}t|�}|D]}t|�qd|_|�t|�g�|�t|�ddg�|�t|�dddddddg�dS)	Nr\r]�rrrrM�)r"r7r/rr1rC)r�aZexhitZempit�xrrr�&test_mutating_seq_class_exhausted_iter�s
z/TestCase.test_mutating_seq_class_exhausted_itercCs$Gdd�dt�}|�tt|��dS)Nc@seZdZdd�ZdS)z5TestCase.test_new_style_iter_class.<locals>.IterClasscSs|Srrrrrrr�sz>TestCase.test_new_style_iter_class.<locals>.IterClass.__iter__Nr,rrrr�	IterClass�srf)�objectr_�	TypeErrorr7)rrfrrr�test_new_style_iter_class�sz"TestCase.test_new_style_iter_classcCs2Gdd�d�}|jt|�d�ttd��dd�dS)Nc@seZdZdd�Zdd�ZdS)z&TestCase.test_iter_callable.<locals>.CcSs
d|_dSr�r
rrrrr�sz/TestCase.test_iter_callable.<locals>.C.__init__cSs |j}|d|_|dkrt�|S)Nr�d)r
r#r$rrr�__call__�s

z/TestCase.test_iter_callable.<locals>.C.__call__N)rrrrrlrrrr�C�srmrGF�r4�r6r7rCr:)rrmrrr�test_iter_callable�s	zTestCase.test_iter_callablecCs0dgfdd�}|jt|d�ttd��dd�dS)NrcSs|d}|d|d<|S)Nrrr��stater
rrr�spam�sz)TestCase.test_iter_function.<locals>.spamrGFrnro�rrsrrr�test_iter_function�szTestCase.test_iter_functioncCs0dgfdd�}|jt|d�ttd��dd�dS)NrcSs$|d}|dkrt�|d|d<|S)NrrGr)rrqrrrrs�s
z.TestCase.test_iter_function_stop.<locals>.spam�rGFrnrortrrr�test_iter_function_stop�sz TestCase.test_iter_function_stopc	Cshdgfdd�}g}zt|d�D]}|�|�qWn(tk
rX|�|ttd���YnX|�d�dS)NrcSs$|d}|d|d<|dkr t�|S)NrrrG)�RuntimeErrorrqrrrrss
z.TestCase.test_exception_function.<locals>.spamrvrG�should have raised RuntimeError)r7r0rxr1rCr:�fail)rrsrrdrrr�test_exception_function�sz TestCase.test_exception_functionc	CshGdd�dt�}g}z|d�D]}|�|�qWn(tk
rX|�|ttd���YnX|�d�dS)Nc@seZdZdd�ZdS)z9TestCase.test_exception_sequence.<locals>.MySequenceClasscSs|dkrt�t�||�SrF)rxr"r%r$rrrr%szETestCase.test_exception_sequence.<locals>.MySequenceClass.__getitem__Nr'rrrr�MySequenceClasssr|rvrGry)r"r0rxr1rCr:rz)rr|rrdrrr�test_exception_sequencesz TestCase.test_exception_sequencecCs0Gdd�dt�}|j|d�ttd��dd�dS)Nc@seZdZdd�ZdS)z4TestCase.test_stop_sequence.<locals>.MySequenceClasscSs|dkrt�t�||�SrF)rr"r%r$rrrr%"sz@TestCase.test_stop_sequence.<locals>.MySequenceClass.__getitem__Nr'rrrrr|!sr|rvrGFrn)r"r9rCr:)rr|rrr�test_stop_sequence szTestCase.test_stop_sequencecCs |�ttd��ttd���dS)Ni'rJrrrr�test_iter_big_range)szTestCase.test_iter_big_rangecCs|�tg�g�dSr�r9r7rrrr�test_iter_empty-szTestCase.test_iter_emptycCs|�td�ttd���dS)N)
rrrrMrbr\rar]��	rG)r9r7rCr:rrrr�test_iter_tuple1szTestCase.test_iter_tuplecCs |�ttd��ttd���dSrFrJrrrr�test_iter_range5szTestCase.test_iter_rangecCs|�td�dddddg�dS�NZabcderc�b�crE�er�rrrr�test_iter_string9szTestCase.test_iter_stringcCs2i}td�D]}d||<q|�|t|����dSrF)r:r9rC�keys)r�dictr
rrr�test_iter_dict=s
zTestCase.test_iter_dictcCs�ttd�}z td�D]}|�d|�qW5|��Xttd�}z.|j|ddddd	gd
d�|j|gd
d�W5|��ztt�Wntk
r�YnXXdS)N�wr\�%d
�r�0
�1
�2
�3
�4
Frn)�openr�closer:�writer�OSErrorr9)r�fr
rrr�test_iter_fileDs


zTestCase.test_iter_filecCs8|�ttd��ttd���|�ttd��g�|�td�g�dddd�}|�t|�t|����|�ttt�|�ttd�ttd	�}z td�D]}|�
d
|�q�W5|�	�Xttd�}zD|�t|�dd
dddg�|�
dd�|�t|�dd
dddg�W5|�	�ztt�Wntk
�r0YnXXdS)Nr\rrrrrM��one�two�three�*r�r�r�r�r�r�r�r�)r1rCr"r:r�r_rhr�rr�r�rr��seek�rrEr�r
rrr�test_builtin_listWs0



�zTestCase.test_builtin_listcCs<|�ttd��d�|�ttd��d�|�tg�d�|�td�d�|�td�d�ddd	d
�}|�t|�t|����|�ttt�|�ttd�ttd�}z t
d�D]}|�d
|�q�W5|�	�Xttd�}z0|�t|�d�|�dd�|�t|�d�W5|�	�ztt�Wnt
k
�r4YnXXdS)Nr\�rrrrMrbrrrA)rcr�r�rrrMr�r�r�r�r�)r�r�r�r�r�)r1�tupler"r�r_rhrCr�rr�r:r�rr�r�r�rrr�test_builtin_tuplevs4



�zTestCase.test_builtin_tuplecCs>|�ttdtd���ttdd���|�ttdtd���g�|�ttdd��g�|�ttdd��dddg�dd	d
d�}|�ttd|��t|����|�ttdt�|�ttdd�Gd
d�d�}|d�}|d�}Gdd�d�}|||gd�}|�ttdd�|��|gd�|�ttdd�t|���|gd�dS)Nr\rrrrArcr�r�rrMr�r�c@seZdZdd�Zdd�ZdS)z-TestCase.test_builtin_filter.<locals>.BooleancSs
||_dSr��truth)rr�rrrr�sz6TestCase.test_builtin_filter.<locals>.Boolean.__init__cSs|jSrr�rrrr�__bool__�sz6TestCase.test_builtin_filter.<locals>.Boolean.__bool__N)rrrrr�rrrr�Boolean�sr�TFc@seZdZdd�Zdd�ZdS)z)TestCase.test_builtin_filter.<locals>.SeqcWs
||_dSr��vals)r�argsrrrr�sz2TestCase.test_builtin_filter.<locals>.Seq.__init__cSsGdd�d�}||j�S)Nc@s$eZdZdd�Zdd�Zdd�ZdS)zCTestCase.test_builtin_filter.<locals>.Seq.__iter__.<locals>.SeqItercSs||_d|_dSr)r�r
)rr�rrrr�szLTestCase.test_builtin_filter.<locals>.Seq.__iter__.<locals>.SeqIter.__init__cSs|Srrrrrrr�szLTestCase.test_builtin_filter.<locals>.Seq.__iter__.<locals>.SeqIter.__iter__cSs0|j}|d|_|t|j�kr(|j|St�dSr)r
�lenr�rr$rrrr�s


zLTestCase.test_builtin_filter.<locals>.Seq.__iter__.<locals>.SeqIter.__next__N�rrrrrrrrrr�SeqIter�sr�r�)rr�rrrr�s
z2TestCase.test_builtin_filter.<locals>.Seq.__iter__Nr!rrrr�Seq�sr��cSs|Srr�rdrrr�<lambda>��z.TestCase.test_builtin_filter.<locals>.<lambda>cSs|Srrr�rrrr��r�)	r1rC�filterr"r:r�r_rhr7)rrEr�ZbTrueZbFalser�r3rrr�test_builtin_filter�s"� zTestCase.test_builtin_filtercCsJ|�ttd��d�|�ttd��d�|�tdd�d�|�tdd�d�dddd	�}|�t|�d
�|�t|�d�|�t|���d�|�tt|����d�ttd�}z"|�	d
�|�	d�|�	d�W5|��Xttd�}z0|�t|�d�|�dd�|�t|�d�W5|��zt
t�Wntk
�rBYnXXdS)Nr\rbrr����rrrMr�r�r�r�zmedium line
zxtra large line
zitty-bitty line
r�)
r1�maxr"�min�valuesr7r�rr�r�rr�r�)rrEr�rrr�test_builtin_max_min�s2




zTestCase.test_builtin_max_mincs|�ttdd�td���ttdd���dddd��|�tt�fd	d����t�����t�������fd
d�td�D�}ttd�}z$td
�D]}|�
d|d�q�W5|�	�Xttd�}z&|�ttt
|��ttddd���W5|�	�ztt�Wntk
�rYnXXdS)NcSs|dSrrr�rrrr��r�z+TestCase.test_builtin_map.<locals>.<lambda>r\rrarrMr�cSs|||fSrr)rPrErrrr��r�cs>g|]6}|t��kr�|pd||t��kr4�|p6df�qSr)r��rSr
�rEZdkeysrrrU�s
��z-TestCase.test_builtin_map.<locals>.<listcomp>r�rGZxy�
r��)r1rC�mapr"r:�itemsr�r�rr�r�rr�r�)r�expectedr�r
rr�r�test_builtin_map�s0�
��


&zTestCase.test_builtin_mapcCs�|�tt��g�|�ttg��g�|�ttddg��ddg�|�ttd�|�tttd�d�|�tttd�t�|�tttd���dd	d
g�|�tttd���dd	d
g�dddd
�}|�t|���tt||�	����Gdd�d�}t
td�}z|�
d�W5|��Xt
td�}z*|�tt|d�||d���dddg�W5|��ztt�Wntk
�rtYnXX|�tttd���dd�td�D��Gdd�d�}Gdd�d|�}Gdd �d |�}d!d"�}|�t|��d�|�t|��d#�|�||��|td���|�||��|td���|�||��|td���d$d�td�D�}|�|�|�fD]0}	|�|�|�fD]}
|�||	|
�|��q|�qhdS)%N�rr�ab)rrc)rr�rGr�rM�r)r)rrrr�c@s$eZdZdd�Zdd�Zdd�ZdS)z+TestCase.test_builtin_zip.<locals>.IntsFromcSs
||_dSrrj)r�startrrrrsz4TestCase.test_builtin_zip.<locals>.IntsFrom.__init__cSs|Srrrrrrrsz4TestCase.test_builtin_zip.<locals>.IntsFrom.__iter__cSs|j}|d|_|Srrjr$rrrrs
z4TestCase.test_builtin_zip.<locals>.IntsFrom.__next__Nr�rrrr�IntsFromsr�r�z	a
bbb
cc
r�r���)r�a
r�)rzbbb
i����)rzcc
i����r\cSsg|]
}|f�qSrrr�rrrrU2sz-TestCase.test_builtin_zip.<locals>.<listcomp>c@seZdZdd�ZdS)z.TestCase.test_builtin_zip.<locals>.NoGuessLen5cSs|dkrt�|S�Nr\)r#r$rrrr%6sz:TestCase.test_builtin_zip.<locals>.NoGuessLen5.__getitem__Nr'rrrr�NoGuessLen55sr�c@seZdZdd�ZdS)z-TestCase.test_builtin_zip.<locals>.Guess3Len5cSsdSrLrrrrr�__len__<sz5TestCase.test_builtin_zip.<locals>.Guess3Len5.__len__N�rrrr�rrrr�
Guess3Len5;sr�c@seZdZdd�ZdS)z.TestCase.test_builtin_zip.<locals>.Guess30Len5cSsdS)N�rrrrrr�@sz6TestCase.test_builtin_zip.<locals>.Guess30Len5.__len__Nr�rrrr�Guess30Len5?sr�cWstt|��Sr)rC�zip)r�rrr�lzipCsz'TestCase.test_builtin_zip.<locals>.lzipr�cSsg|]}||f�qSrrr�rrrrULs)r1rCr�r_rhr:rr"r�r�r�rr�r�rr�r�)rrEr�r�r�r�r�r�r�rd�yrrr�test_builtin_zips\��"


��&zTestCase.test_builtin_zipcCs�Gdd�d�}ttd�}z|�d�W5|��Xttd�}zd�||��}|�|d�W5|��ztt�Wntk
r�YnXXdS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z4TestCase.test_unicode_join_endcase.<locals>.OhPhooeycSst|�|_d|_dSr)r7r2r
)rr3rrrrVs
z=TestCase.test_unicode_join_endcase.<locals>.OhPhooey.__init__cSs|SrrrrrrrZsz=TestCase.test_unicode_join_endcase.<locals>.OhPhooey.__iter__cSs&|j}|d|_|dkrdSt|j�S)Nrrzfooled you!)r
r/r2r$rrrr]s

z=TestCase.test_unicode_join_endcase.<locals>.OhPhooey.__next__Nr�rrrr�OhPhooeyUsr�r��a
b
c
r�z - za
 - b
 - fooled you! - c
)r�rr�r�rr��joinr1)rr�r�Zgotrrr�test_unicode_join_endcaseQs


z"TestCase.test_unicode_join_endcasecCs�td�td�fD]J}td�D]}|�||�qdddddgddid|f	D]}|�||�qHq|�tdd	��|�td
d	��|�tdd	��ddd
dd�}|D] }|�||�|�||���q�|��D] }|�||���|�||�q�|�	�D]0\}}|�||f|�	��|�||f|�	��q�t
td�}z|�
d�W5|��Xt
td�}zDdD]:}|�dd�|�||�|�dd�|�|d|��qXW5|��ztt�Wntk
�r�YnXXdS)Nr\rAr�g�(\��5E@)rMrbry@(�cSsddkS)NrM�rrrrrr��r�z-TestCase.test_in_and_not_in.<locals>.<lambda>cSsdtkSrL)r�rrrrr��r�cSs
dt�kSrL)r*rrrrr��r�rrM�@�r�r�r���?r�r�r�rr�)rr"r:ZassertInZassertNotInr_rhr+r�r�r�rr�r�rr�r�)rZsc5r
rErP�vr��chunkrrr�test_in_and_not_in{sD


zTestCase.test_in_and_not_incCs�ddlm}|�|ddddddgd�d�|�|dd�d�|�|dd	�d�|�|dd
�d�|�t|dd�|�t|||�ddddd
�}|D]}|�|||�d�q�|�||��d�d�|�||��d�d�|�||��d�d�ttd�}z|�	d�W5|��Xttd�}z6dD],\}}|�dd�|�|||d�|��q W5|��zt
t�Wntk
�r|YnXXdS)Nr)�countOfrrrMr\�rrrrMrr\�122325�2�6r�r�r�r�r�za
b
c
b
r�))rcr)r�r)r�r)rErr�)
�operatorr�r1r_rhr�r�rr�r�rr�r�)rr�rErPr�Zletter�countrrr�test_countOf�s6


zTestCase.test_countOfcCs�ddlm}|�|ddddddgd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�t|dd�|�t|dd�|�|d	d
�d�|�|d	d�d�|�t|d	d�|�t|d
d�|�t|||�|�t|t�d�tt	d�}z|�d�W5|�
�Xtt	d�}zRt|�}|�||d�d�|�||d�d�|�||d�d�|�t||d�W5|�
�ztt	�Wnt
k
�r�YnXXtd�}td�D]}|�|||�|��q�|�t||d�dS)Nr)�indexOfrrrMr\r�rar�r��5r�r�r�z
a
b
c
d
e
r�zb
zd
ze
r�r�)r�r�r1r_�
ValueErrorrhr+r*r�rr�r�rr�r7rr:)rr�r�ZfiterZiclassr
rrr�test_indexOf�sB


zTestCase.test_indexOfcs�ttd�}z�|�t|jd�|�t|jd�|�ddg�|�d�|�ddi�|�i�Gdd�d��G�fd	d
�d
�}|�|dd��|��tt�}d
d�tdd�D�}|�	t
|�|�W5|��ztt�Wntk
r�YnXXdS)Nr�r�r�r�)r�r�z5
c@s$eZdZdd�Zdd�Zdd�ZdS)z*TestCase.test_writelines.<locals>.IteratorcSs||_||_|j|_dSr)r��finishr
�rr�r�rrrrsz3TestCase.test_writelines.<locals>.Iterator.__init__cSs0|j|jkrt�t|j�d}|jd7_|S)Nr�r)r
r�r�str)r�resultrrrrs
z3TestCase.test_writelines.<locals>.Iterator.__next__cSs|Srrrrrrrsz3TestCase.test_writelines.<locals>.Iterator.__iter__NrrrrrrB�srBcs eZdZdd�Z�fdd�ZdS)z*TestCase.test_writelines.<locals>.WhatevercSs||_||_dSr�r�r�r�rrrrsz3TestCase.test_writelines.<locals>.Whatever.__init__cs�|j|j�Srr�r�rBrrrsz3TestCase.test_writelines.<locals>.Whatever.__iter__Nr!rr�rr�Whateversr�rai�cSsg|]}t|�d�qS)r�)r�r�rrrrUsz,TestCase.test_writelines.<locals>.<listcomp>r)r�rr�rr�r_rh�
writelinesr:r1rC)rr�r�r�rr�r�test_writelines�s(


zTestCase.test_writelinescCs�d\}}|�||fd�td�\}}}|�|||fd�ztd�\}}Wntk
r\YnX|�d�ztd�\}}}Wntk
r�YnX|�d�zt\}}}Wntk
r�YnX|�d�dddd���\}}}|�|||fd	�ttd
�}d}z|D]}|�
|��qW5|�	�Xttd�}z |\}}}|�|||f|�W5|�	�ztt�Wntk
�rzYnXXtd�dd
i\}}\}|�|||fd�dS)Nr�rMr	zshould have raised ValueErrorrzshould have raised TypeErrorr�)rrrM)r�r�r�r�)r�zbb
zccc
r��)rrr�)
r1rr�rzr�rhr�r�rr�r�rr�)rrcr�r�r��lines�linerrr�test_unpack_iter'sL






zTestCase.test_unpack_itercCs�Gdd�dt�}|�}|�|jd�~|�|jd�|�|�|�g}|�|jd�zt|�\}}Wntk
rvYnX~|�|jd�dS)Nc@s eZdZdZdd�Zdd�ZdS)z.TestCase.test_ref_counting_behavior.<locals>.CrcSs|jd7_t�|�Sr)r�rg�__new__)�clsrrrr�`sz6TestCase.test_ref_counting_behavior.<locals>.C.__new__cSs|j}|jd8_dSr)�	__class__r�)rr�rrr�__del__csz6TestCase.test_ref_counting_behavior.<locals>.C.__del__N)rrrr�r�r�rrrrrm^srmrrrM)rgr1r�r7r�)rrmrd�lrcr�rrr�test_ref_counting_behavior\s	z#TestCase.test_ref_counting_behaviorcCsPttd��}t|�}|�t|�ttd���|�tdd��|�t|�g�dS�Nr\rG)rCr:r7r1�extend�rrcr�rrr�test_sinkstate_listys
zTestCase.test_sinkstate_listcCs8d}t|�}|�t|�ttd���|�t|�g�dS)Nr�r\�r7r1rCr:rrrr�test_sinkstate_tuple�szTestCase.test_sinkstate_tuplecCs:d}t|�}|�t|�dddddg�|�t|�g�dSr�)r7r1rCrrrr�test_sinkstate_string�szTestCase.test_sinkstate_stringcCsBtd�}t|�}|�t|�ttd���d|_|�t|�g�dSr)r"r7r1rCr:rrrrr�test_sinkstate_sequence�s
z TestCase.test_sinkstate_sequencecCsDdgfdd�}t|d�}|�t|�ttd���|�t|�g�dS)NrcSs(|d}|d|d<|dkr$td��|S)NrrrGzshouldn't have gotten this far)�AssertionErrorrqrrrrs�s
z.TestCase.test_sinkstate_callable.<locals>.spamr\r)rrsr�rrr�test_sinkstate_callable�s
z TestCase.test_sinkstate_callablecCsbdddddd�}t|�|��|��|��fD]0}t|�}|�tt|��d�|�t|�g�q,dS)NrrrrbrM)rrrrbrMr\)r7r�r�r�r1r�rCrrrr�test_sinkstate_dict�s
 zTestCase.test_sinkstate_dictcCs:dd�}|�}|�t|�ttd���|�t|�g�dS)Ncsstd�D]
}|VqdSr��r:rjrrr�gen�sz*TestCase.test_sinkstate_yield.<locals>.genr\)r1rCr:)rr
r�rrr�test_sinkstate_yield�szTestCase.test_sinkstate_yieldcCs<td�}t|�}|�t|�ttd���|�t|�g�dSr�)r:r7r1rCrrrr�test_sinkstate_range�szTestCase.test_sinkstate_rangecCsNtd�}t|�}t|�}|�t|�tttd�td����|�t|�g�dSr�)r:�	enumerater7r1rCr�)rrcr�r�rrr�test_sinkstate_enumerate�s
"z!TestCase.test_sinkstate_enumeratecs>G�fdd�dt��z��D]}qWntk
r8YnXdS)Ncs eZdZdd�Z�fdd�ZdS)z'TestCase.test_3720.<locals>.BadIteratorcSs|Srrrrrrr�sz0TestCase.test_3720.<locals>.BadIterator.__iter__cs�`dSr)rr��BadIteratorrrr�sz0TestCase.test_3720.<locals>.BadIterator.__next__N)rrrrrrrrrr�sr)rgrhr$rrr�	test_3720�s
zTestCase.test_3720cCsJdd�}dgd}td�D]}|�d�q|�|��|�t|�d�dS)Ncsstd�D]
}|VqdS)N��rrjrrrr
�szITestCase.test_extending_list_with_iterator_does_not_segfault.<locals>.genrr��i�)r:�poprr1r�)rr
Zlstr
rrr�3test_extending_list_with_iterator_does_not_segfault�s
z<TestCase.test_extending_list_with_iterator_does_not_segfaultc	Cs�tt��}|�tjd�|�t|�tjd�|�t|�tjd�|�t��t|�W5QRX|�t��t|�W5QRXdS)Nrr)	r7r&�__setstate__�sys�maxsizer1r/r_�
OverflowError�rr2rrr�test_iter_overflow�s
zTestCase.test_iter_overflowcCs8tt��}|�d�|�t|�d�|�t|�d�dS)Ni���rr)r7r&rr1r/rrrr�test_iter_neg_setstate�s

zTestCase.test_iter_neg_setstatecCst|ttd�dS)Nr�)rr7r"rrrr�test_free_after_iterating�sz"TestCase.test_free_after_iteratingcCs2ttfD]}|�tt|��q|�ttt��dSr)r(r)r_rhr7r+r*)r�typrrr�test_error_iter�szTestCase.test_error_iterN)T)T)=rrrr6r9r.rHrIrKrQrVrWrXrYrZr[r`rerirprurwr{r}r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr
rrrrrrrrr r"rrrrr-Gsv

	
$

	!- O**#*55
	

r-cCstt�dSr)rr-rrrr�	test_main�sr#�__main__)rZunittestZtest.supportrrrrrr4�collections.abcr@rNr
rr"r&r(r)r*r-r#rrrrr�<module>sb�
	:


F1le Man4ger