Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_xml_etree_c.cpython-39.opt-1.pyc

a

XC?h�!�@s�ddlZddlZddlmZddlmZddlZddlZeddgd�Zedddgd	d
�Z	e�
ed�Gdd
�d
ej��Ze�
ed�Gdd�dej��Z
e�
ed�ejGdd�dej���Ze�
ed�ejGdd�dej���Zdd�Zedkr�e�dS)�N)�support)�import_fresh_modulezxml.etree.ElementTree�_elementtree)�freshzxml.etree.cElementTreez	xml.etreeT)rZ
deprecatedzrequires _elementtreec@sxeZdZejejdddd�dd��Zdd�Zd	d
�Zdd�Z	d
d�Z
ejdd��Zdd�Z
dd�Zdd�Zdd�ZdS)�	MiscTests�d�F)�sizeZmemuseZdry_runcCs4d|}t��}z|�t|j|�Wd}nd}0dS)N�x)�cET�	XMLParser�assertRaises�
OverflowError�feed)�selfr	�data�parser�r�:/opt/alt/python39/lib64/python3.9/test/test_xml_etree_c.py�test_length_overflows
zMiscTests.test_length_overflowcCs�t�d�}d|_|�t��|`Wd�n1s40Y|�|jd�|�t��|`Wd�n1sp0Y|�|j�d|_|�t��|`Wd�n1s�0Y|�|jd�|�t��|`Wd�n1s�0Y|�|j�d|_|�t��|`Wd�n1�s.0Y|�|jd�|�t��|`	Wd�n1�sl0Y|�|j	i�ddd�|_	|�t��|`	Wd�n1�s�0Y|�|j	ddd��dS)N�tagZTAGZTEXTZTAIL�B�D)�A�C)
r�Elementrr
�AttributeError�assertEqual�text�assertIsNone�tail�attrib)rZelementrrr�test_del_attributes4
""""$$$zMiscTests.test_del_attributecCs8t�d�}}td�D]}t�|d�}q~~t��dS)N�rooti@
�x)rr�range�
SubElementr�
gc_collect)r�er#�irrr�
test_trashcan<szMiscTests.test_trashcancCsdd�}|�t��dS)Nc
Ss>t��}zt�Wn(ty8}z|}WYd}~n
d}~00dS�N)rr�
ValueError)r�exc�errrrr�parser_ref_cycleJs
z9MiscTests.test_parser_ref_cycle.<locals>.parser_ref_cycle)rr')rr/rrr�test_parser_ref_cycleEs
zMiscTests.test_parser_ref_cyclecs�t�d��G�fdd�d�}|��_���|��_���|��_|��_���|��_|��_���|��_��ddi����|��_��ddi�dS)N�elemcseZdZ�fdd�ZdS)z#MiscTests.test_bpo_31728.<locals>.Xcs�j�j���dSr+)rr �clear�r�r1rr�__del___sz+MiscTests.test_bpo_31728.<locals>.X.__del__N)�__name__�
__module__�__qualname__r5rr4rr�X^sr9r�*)rrrr2r �__setstate__)rr9rr4r�test_bpo_31728Ys"
zMiscTests.test_bpo_31728cCsxtj�tj�}|�t|j�|�t|jd�Gdd�d�}|�t|j|��|�t|jd�|�	|j
�|�	|j�dS)N�fooc@seZdZdd�ZdS)z5MiscTests.test_uninitialized_parser.<locals>.MockFilecWsdS)N�r)�argsrrr�read�sz:MiscTests.test_uninitialized_parser.<locals>.MockFile.readN)r6r7r8r@rrrr�MockFile�srA)rr�__new__r
r,�closerZ_parse_wholeZ
_seteventsrZentity�target)rrrArrr�test_uninitialized_parserysz#MiscTests.test_uninitialized_parserc	Cs�tj�tj�}td�D]&}|�dddit�d�gddd��q|�|jd�|�|jd�|�|jd�|�t	|j
���d	g�|�t|�d
�|�|djd�dS)Nrr=�barr:�childztext goes herezopposite of head)rr!Z	_childrenrr )rFr:rr)
rrrBr%r;rrrr �listr!�items�len)rr1r)rrr�test_setstate_leaks�s
�
zMiscTests.test_setstate_leakscCs*d}t�t�|��}t|�~t��dS�Nz<a></a></b>)rZ	iterparse�io�StringIO�nextrr'�rZXMLrrrr�test_iterparse_leaks�s
zMiscTests.test_iterparse_leakscCs$d}t��}|�|�~t��dSrL)rZ
XMLPullParserrrr'rPrrr�test_xmlpullparser_leaks�s

z"MiscTests.test_xmlpullparser_leakscs<G�fdd�d�}t�dddi����|��}|�|�dS)NcseZdZ�fdd�ZdS)z;MiscTests.test_dict_disappearing_during_get_item.<locals>.Xcsi�_dd�td�D�dS)NcSsg|]}||i�qSrr)�.0r)rrr�
<listcomp>��zXMiscTests.test_dict_disappearing_during_get_item.<locals>.X.__hash__.<locals>.<listcomp>i��
)r!r%r3�r(rr�__hash__�szDMiscTests.test_dict_disappearing_during_get_item.<locals>.X.__hash__N)r6r7r8rXrrWrrr9�sr9r1r�)rr�getr)rr9�rrrWr�&test_dict_disappearing_during_get_item�sz0MiscTests.test_dict_disappearing_during_get_itemN)r6r7r8rZ
bigmemtestZ_2Grr"r*r0r<�cpython_onlyrErKrQrRr\rrrrrs
 	 


rc@seZdZdd�ZdS)�TestAliasWorkingcCst�d�}|�|jd�dS)Nr=)�	cET_aliasrrr�rr(rrr�test_alias_working�s
z#TestAliasWorking.test_alias_workingN)r6r7r8rarrrrr^�sr^c@s$eZdZdd�Zdd�Zdd�ZdS)�TestAcceleratorImportedcCs|�tjjd�dS�Nr)rrr&r7r3rrr�test_correct_import_cET�sz/TestAcceleratorImported.test_correct_import_cETcCs|�tjjd�dSrc)rr_r&r7r3rrr�test_correct_import_cET_alias�sz5TestAcceleratorImported.test_correct_import_cET_aliascCs|�tjjtj�dSr+)ZassertNotIsInstancerr�__init__�types�FunctionTyper3rrr�test_parser_comes_from_C�sz0TestAcceleratorImported.test_parser_comes_from_CN)r6r7r8rdrerirrrrrb�srbc@s2eZdZdd�ZejZdd�Zdd�Zdd�Zd	S)
�
SizeofTestcCst�d�|_t�d�|_dS)NZ5PZPnnP4P)rZcalcobjsize�elementsize�struct�calcsize�extrar3rrr�setUp�szSizeofTest.setUpcCst�d�}|�||j�dS)N�a)rr�check_sizeofrkr`rrr�test_element�s
zSizeofTest.test_elementcCs&tjddd�}|�||j|j�dS)Nrpzabout:)Zhref)rrrqrkrnr`rrr�test_element_with_attrib�sz#SizeofTest.test_element_with_attribcCsFt�d�}td�D]}t�|d�q|�||j|jt�d��dS)Nrp��spanZ8P)	rrr%r&rqrkrnrlrm)rr(r)rrr�test_element_with_children�s
�z%SizeofTest.test_element_with_childrenN)	r6r7r8rorrqrrrsrvrrrrrj�s
rjcCs,ddlm}t�tttt�|jt	d�dS)Nr��test_xml_etree)�module)
�testrxrZrun_unittestrr^rbrj�	test_mainrrwrrrr{�s�r{�__main__)rMrlrzrZtest.supportrrgZunittestrr_Z
skipUnlessZTestCaserr^r]rbrjr{r6rrrr�<module>s4��
)