Your IP : 216.73.216.213


Current Path : /opt/alt/python38/lib64/python3.8/test/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/test/__pycache__/test_xml_etree_c.cpython-38.pyc

U

i�f; �@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@speZdZejejdddd�dd��Zdd�Zd	d
�Zdd�Z	d
d�Z
ejdd��Zdd�Z
dd�Zdd�ZdS)�	MiscTests�d�F)�sizeZmemuseZdry_runcCs0d|}t��}z|�t|j|�W5d}XdS)N�x)�cET�	XMLParser�assertRaises�
OverflowError�feed)�selfr	�data�parser�r�:/opt/alt/python38/lib64/python3.8/test/test_xml_etree_c.py�test_length_overflows
zMiscTests.test_length_overflowc	CsFt�d�}d|_|�t��
|`W5QRX|�|jd�|�t��
|`W5QRX|�|j�d|_|�t��
|`W5QRX|�|jd�|�t��
|`W5QRX|�|j�d|_|�t��
|`W5QRX|�|jd�|�t��
|`	W5QRX|�|j	i�ddd�|_	|�t��
|`	W5QRX|�|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&tk
r6}z|}W5d}~XYnXdS�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:Zchildztext 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��dSrK)rZ
XMLPullParserrrr'rOrrr�test_xmlpullparser_leaks�s

z"MiscTests.test_xmlpullparser_leaksN)r6r7r8rZ
bigmemtestZ_2Grr"r*r0r<�cpython_onlyrErJrPrQrrrrrs
 	 

rc@seZdZdd�ZdS)�TestAliasWorkingcCst�d�}|�|jd�dS)Nr=)�	cET_aliasrrr�rr(rrr�test_alias_working�s
z#TestAliasWorking.test_alias_workingN)r6r7r8rVrrrrrS�srSc@s$eZdZdd�Zdd�Zdd�ZdS)�TestAcceleratorImportedcCs|�tjjd�dS�Nr)rrr&r7r3rrr�test_correct_import_cET�sz/TestAcceleratorImported.test_correct_import_cETcCs|�tjjd�dSrX)rrTr&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)r6r7r8rYrZr^rrrrrW�srWc@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_sizeofr`rUrrr�test_element�s
zSizeofTest.test_elementcCs&tjddd�}|�||j|j�dS)Nrezabout:)Zhref)rrrfr`rcrUrrr�test_element_with_attrib�sz#SizeofTest.test_element_with_attribcCsFt�d�}td�D]}t�|d�q|�||j|jt�d��dS)Nre��spanZ8P)	rrr%r&rfr`rcrarb)rr(r)rrr�test_element_with_children�s
�z%SizeofTest.test_element_with_childrenN)	r6r7r8rdrrfrgrhrkrrrrr_�s
r_cCs,ddlm}t�tttt�|jt	d�dS)Nr��test_xml_etree)�module)
�testrmrZrun_unittestrrSrWr_�	test_mainrrlrrrrp�s�rp�__main__)rLrarorZtest.supportrr\ZunittestrrTZ
skipUnlessZTestCaserrSrRrWr_rpr6rrrr�<module>s4��