Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_xml_etree_c.cpython-310.opt-2.pyc

o

0�i�!�@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�dSdS)�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_runcCs2d|}t��}z
|�t|j|�Wd}dSd}w)N�x)�cET�	XMLParser�assertRaises�
OverflowError�feed)�selfr	�data�parser�r�</opt/alt/python310/lib64/python3.10/test/test_xml_etree_c.py�test_length_overflows
zMiscTests.test_length_overflowcCs�t�d�}d|_|�t��
|`Wd�n1swY|�|jd�|�t��
|`Wd�n1s8wY|�|j�d|_|�t��
|`Wd�n1sXwY|�|jd�|�t��
|`Wd�n1svwY|�|j�d|_|�t��
|`Wd�n1s�wY|�|jd�|�t��
|`	Wd�n1s�wY|�|j	i�ddd�|_	|�t��
|`	Wd�n1s�wY|�|j	ddd��dS)N�tagZTAGZTEXTZTAIL�B�D)�A�C)
r�Elementrr
�AttributeError�assertEqual�text�assertIsNone�tail�attrib)rZelementrrr�test_del_attributesB
�������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
Ss8t��}zt�ty}z	|}WYd}~dSd}~ww�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�elemc�eZdZ�fdd�ZdS)z#MiscTests.test_bpo_31728.<locals>.Xcs�j�j���dSr+)rr �clear�r�r1rr�__del___sz+MiscTests.test_bpo_31728.<locals>.X.__del__N)�__name__�
__module__�__qualname__r6rr5rr�X^�r:r�*)rrrr3r �__setstate__)rr:rr5r�test_bpo_31728Ys"
zMiscTests.test_bpo_31728cCsxtj�tj�}|�t|j�|�t|jd�Gdd�d�}|�t|j|��|�t|jd�|�	|j
�|�	|j�dS)N�fooc@�eZdZdd�ZdS)z5MiscTests.test_uninitialized_parser.<locals>.MockFilecWsdS)N�r)�argsrrr�read�sz:MiscTests.test_uninitialized_parser.<locals>.MockFile.readN)r7r8r9rCrrrr�MockFile�srD)rr�__new__r
r,�closerZ_parse_wholeZ
_seteventsrZentity�target)rrrDrrr�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 )rIr<rr)
rrrEr%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��dSrO)rZ
XMLPullParserrrr'rSrrr�test_xmlpullparser_leaks�s

z"MiscTests.test_xmlpullparser_leakscs<G�fdd�d�}t�dddi����|��}|�|�dS)Ncr2)z;MiscTests.test_dict_disappearing_during_get_item.<locals>.Xcsi�_dd�td�D�dS)NcSsg|]}||i�qSrr)�.0r)rrr�
<listcomp>�szXMiscTests.test_dict_disappearing_during_get_item.<locals>.X.__hash__.<locals>.<listcomp>i��
)r!r%r4�r(rr�__hash__�szDMiscTests.test_dict_disappearing_during_get_item.<locals>.X.__hash__N)r7r8r9rZrrYrrr:�r;r:r1r�)rr�getr)rr:�rrrYr�&test_dict_disappearing_during_get_item�sz0MiscTests.test_dict_disappearing_during_get_itemN)r7r8r9rZ
bigmemtestZ_2Grr"r*r0r>�cpython_onlyrHrNrTrUr^rrrrrs
 	 


rc@r@)�TestAliasWorkingcCst�d�}|�|jd�dS)Nr?)�	cET_aliasrrr�rr(rrr�test_alias_working��
z#TestAliasWorking.test_alias_workingN)r7r8r9rcrrrrr`�sr`c@s$eZdZdd�Zdd�Zdd�ZdS)�TestAcceleratorImportedcC�|�tjjd�dS�Nr)rrr&r8r4rrr�test_correct_import_cET�sz/TestAcceleratorImported.test_correct_import_cETcCrfrg)rrar&r8r4rrr�test_correct_import_cET_alias�sz5TestAcceleratorImported.test_correct_import_cET_aliascCs|�tjjtj�dSr+)ZassertNotIsInstancerr�__init__�types�FunctionTyper4rrr�test_parser_comes_from_C�sz0TestAcceleratorImported.test_parser_comes_from_CN)r7r8r9rhrirmrrrrre�srec@s2eZdZdd�ZejZdd�Zdd�Zdd�Zd	S)
�
SizeofTestcCst�d�|_t�d�|_dS)NZ5PZPnnP4P)rZcalcobjsize�elementsize�struct�calcsize�extrar4rrr�setUp�szSizeofTest.setUpcCst�d�}|�||j�dS)N�a)rr�check_sizeofrorbrrr�test_element�rdzSizeofTest.test_elementcCs&tjddd�}|�||j|j�dS)Nrtzabout:)Zhref)rrrurorrrbrrr�test_element_with_attrib�sz#SizeofTest.test_element_with_attribcCsFt�d�}td�D]}t�|d�q	|�||j|jt�d��dS)Nrt��spanZ8P)	rrr%r&rurorrrprq)rr(r)rrr�test_element_with_children�s

�z%SizeofTest.test_element_with_childrenN)	r7r8r9rsrrurvrwrzrrrrrn�srncCs,ddlm}t�tttt�|jt	d�dS)Nr��test_xml_etree)�module)
�testr|rZrun_unittestrr`rern�	test_mainrr{rrrr�s�r�__main__)rPrpr~rZtest.support.import_helperrrkZunittestrraZ
skipUnlessZTestCaserr`r_rernrr7rrrr�<module>s8��

)


�