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_asdl_parser.cpython-38.pyc
U

>��g��@s�dZddlZddlZddlmZddlZddlZddlZe�	�sJe�
d��eeee���Zej
�ed�ZGdd�dej�Zedkr�e��dS)	z+Tests for the asdl parser in Parser/asdl.py�N)�dirnamez'test irrelevant for an installed PythonZParserc@s\eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�TestAsdlParsercCsbtj�dt�tj�dtj�td��}|�	�|_
|j
�tj�td��|_|�
|j
�|j�d�dS)Nr�asdlzasdl.pyzPython.asdlzModule validation failed)�sys�path�insert�
parser_dir�	importlib�	machinery�SourceFileLoader�os�join�load_moduler�parse�mod�
assertTrue�check)�cls�loader�r�4/opt/cppython/lib/python3.8/test/test_asdl_parser.py�
setUpClasss�
zTestAsdlParser.setUpClasscCstjd=dS)Nr)rr)rrrr�
tearDownClass!szTestAsdlParser.tearDownClasscCstj|_tj|_|jj|_dS�N)rrr�types��selfrrr�setUp%szTestAsdlParser.setUpcCs>|�|jjd�|�d|j�|�d|j�|�d|j�dS)N�Python�stmt�exprr)�assertEqualr�nameZassertInrrrrr�test_module+szTestAsdlParser.test_modulecCsb|jj}|�|d|jj�|�|dj|jj�|�|jd|jj�|�|jd|jj�dS)NrZwithitem�alias)	r�dfns�assertIsInstancerZType�valueZSumrZProduct)rZdefsrrr�test_definitions1s
zTestAsdlParser.test_definitionscCs|jd}|�t|�d�dS)Nr$zGProduct([Field(identifier, name), Field(identifier, asname, opt=True)]))rr!�str)rr$rrr�test_product9s

�zTestAsdlParser.test_productcCsx|jd}|�t|j�d�|�t|jd�d�|�t|jd�d�|�t|jd�d�|�t|jd	�d
�dS)Nr�rzField(int, lineno)�zField(int, col_offset)�z Field(int, end_lineno, opt=True)�z$Field(int, end_col_offset, opt=True))rr!�len�
attributesr))rrrrr�test_attributes?s
zTestAsdlParser.test_attributescCs|jd}|�t|j�d�|�t|j�d�|jd}|�||jj�|�t|j�d�|jd}|�|jd�|�|j	d�|�
|j�|jd}|�|jd�|�|j	d	�|�
|j�|jd
}|�|jd�|�|j	d�|�|j�|�
|j
�dS)
NZ
excepthandlerr,r+rr.r �typeZ
identifierr"r-rZbody)rr!r/r0r&rZConstructor�fieldsr2r"r�optZassertFalse�seq)rZehandler�consZf0�f1�f2rrr�test_constructor_fieldsGs&




z&TestAsdlParser.test_constructor_fieldscCsFGdd�d|jj�}|�}|�|jd�|�|jdddddg�dS)Ncs<eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Z�ZS)z2TestAsdlParser.test_visitor.<locals>.CustomVisitorcst���g|_dSr)�super�__init__�names_with_seqr��	__class__rrr;bs
z;TestAsdlParser.test_visitor.<locals>.CustomVisitor.__init__cSs|jD]}|�|�qdSr)r%�visit)rrZdfnrrr�visitModulefs
z>TestAsdlParser.test_visitor.<locals>.CustomVisitor.visitModulecSs|�|j�dSr)r?r')rr2rrr�	visitTypejsz<TestAsdlParser.test_visitor.<locals>.CustomVisitor.visitTypecSs|jD]}|�|�qdSr)rr?)r�sum�trrr�visitSumms
z;TestAsdlParser.test_visitor.<locals>.CustomVisitor.visitSumcSs$|jD]}|jr|j�|j�qdSr)r3r5r<�appendr")rr6�frrr�visitConstructorqs
zCTestAsdlParser.test_visitor.<locals>.CustomVisitor.visitConstructor)	�__name__�
__module__�__qualname__r;r@rArDrG�
__classcell__rrr=r�
CustomVisitoras
rLrZModuleZInteractive�FunctionTypeZSuite)rZVisitorBaser?rr!r<)rrL�vrrr�test_visitor`s�zTestAsdlParser.test_visitorN)
rHrIrJ�classmethodrrrr#r(r*r1r9rOrrrrrs

r�__main__)�__doc__Zimportlib.machineryr	rZos.pathrrZ	sysconfigZunittestZis_python_buildZSkipTest�__file__Zsrc_baserr
rZTestCaserrH�mainrrrr�<module>s
i

F1le Man4ger