HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_asdl_parser.cpython-37.opt-2.pyc
B

��g��@s�ddlZddlZddlmZddlZddlZddlZe��sFe�	d��eeee
���Zej�
ed�ZGdd�dej�Zedkr�e��dS)�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�
assertTrueZcheck)�cls�loader�r�1/usr/local/lib/python3.7/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�nameZassertInr)rrrr�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_productcCsL|jd}|�t|j�d�|�t|jd�d�|�t|jd�d�dS)Nr�rzField(int, lineno)�zField(int, col_offset))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(r�r�typeZ
identifierrrZbody)rrr*r+r#rZConstructor�fieldsr.rr�optZassertFalse�seq)rZehandler�consZf0�f1�f2rrr�test_constructor_fieldsEs&




z&TestAsdlParser.test_constructor_fieldscCsBGdd�d|jj�}|�}|�|jd�|�|jdddg�dS)Ncs<eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Z�ZS)z2TestAsdlParser.test_visitor.<locals>.CustomVisitorcst���g|_dS)N)�super�__init__�names_with_seq)r)�	__class__rrr7`s
z;TestAsdlParser.test_visitor.<locals>.CustomVisitor.__init__cSsx|jD]}|�|�qWdS)N)r"�visit)rrZdfnrrr�visitModuledsz>TestAsdlParser.test_visitor.<locals>.CustomVisitor.visitModulecSs|�|j�dS)N)r:r$)rr.rrr�	visitTypehsz<TestAsdlParser.test_visitor.<locals>.CustomVisitor.visitTypecSsx|jD]}|�|�qWdS)N)rr:)r�sum�trrr�visitSumksz;TestAsdlParser.test_visitor.<locals>.CustomVisitor.visitSumcSs(x"|jD]}|jr|j�|j�qWdS)N)r/r1r8�appendr)rr2�frrr�visitConstructoroszCTestAsdlParser.test_visitor.<locals>.CustomVisitor.visitConstructor)	�__name__�
__module__�__qualname__r7r;r<r?rB�
__classcell__rr)r9r�
CustomVisitor_s
rGrZModuleZInteractiveZSuite)rZVisitorBaser:rrr8)rrG�vrrr�test_visitor^szTestAsdlParser.test_visitorN)
rCrDrE�classmethodrrrr r%r'r,r5rIrrrrrs
r�__main__)Zimportlib.machineryr	rZos.pathrrZ	sysconfigZunittestZis_python_buildZSkipTest�__file__Zsrc_baserr
rZTestCaserrC�mainrrrr�<module>s
f