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_ast.cpython-38.opt-1.pyc

U

i�f�c�O@s~ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
dd�Zdddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHgCZdIgZ
ddJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkg#ZGdldm�dmej�ZGdndo�doej�ZGdpdq�dqej�ZGdrds�dsej�ZGdtdu�duej�ZGdvdw�dwej�Zdxdy�Zdzd{ggfdzd|ggfdzd}d~dd�ggdggdgfd�ggddfggfdzd}d~dd�ggdggdgfd�ggddfggfdzd}d~dd�gd�gdggdgfd�ggddfggfdzd}d~dd�gd�gdggdd�gfd�ggddfggfdzd}d~dd�ggd�ggdgfd�ggddfggfdzd}d~dd�ggdggd�gfd�ggddfggfdzd}d~dd�gd�d�d�d�d�gd�d�gd�gd�d�d�d�d�gd�fd�d�ggfgfd�ggddfggfdzd�d~d�ggd�ggfggfdzd�d~d�ggd�ggfggfdzd�d~d�d�ggd�ggfggfdzd}d~dd�ggdggdgfd�ggddfggfdzd�d~d�gfggfdzd�d~d�gd�dfggfdzd�d~d�d~d�d�gd�fgd�dfggfdzd�d~d�d~d�d�gd�fgd�dfggfdzd�d~d�d~d�d�gd�fgd�dfggfdzd�ggfdzd�d~d�d�d�ggdfggfdzd�d~d�d�ggfggfdzd�d~d�d�ggfggfdzd�d~d�d�gd�d�d�d�ggfgfggfdzd�d~d�d�gd�d�d�d�gd�gfgfggfdzd�d~d�gd�gdfggfdzd�d~d�d�gd�gdfggfdzd�d~d�d�d�d�ggfdfggfdzd�d~d�gd�d�d�dd�gfgggfggfdzd�d~d�gggd�gfggfdzd�ggfdzd�d~d�gfggfdzd�d~d�d�gdfggfdzd�d~degfggfdzd�ggfdzd�ggfdzd�d~d�d�d�ggdfggfdzd�d~d�d�d�ggdfggfdzd�d~d�d�d�d�gd�fd�d�ggdfggfdzd�d~d�d�d�d�gd�fd�d�ggdfggfdzd�d~d�d�d�d�gd�fd�d�ggdfggfdzd�d~d�d~d�d�d�d�gd�fd�d�d�d�d�gd�fd�gdfgffggfdzd�d~d�d~d�d�d�d�d�gdfd�d�d�d�gdfgffggfdzd�d~d�d~d�d�d�d�d�d�d�gd�fd�gdfgffggfdzd�d~d�d~d�d�d�d�d�gdfgffggfdzd�d~d�d~d�d�d�d�d�d�gd�fd�gdfgffggfdzd�d~dd�ggdggdgfd�d�d�d�d�dĐd�dggfffggddfggfdzd�d~dd�ggdggdgf�d�d�d�d�dg�dgdfggddfggfdzd�d~dd�ggdggdgf�d�d�d	g�d
gdfggddfggfdzd�d~d�d~d�dgd��dd�g�d
gf�dgffggfdzd�d~�dd~�d�d�d�d�d�d
gfd�f�dgffggfdzd�d~dd�ggdggdgfdސd�d�d�dd�d�dg�dfgffggddfggfdzd}�ddd�ggdggdgf�dg�ddĐd�dggfd�d��d�dggfgddfggfdzd��ddd�ggdggdgf�d g�ddĐd�dggfd�d��d�dggfgddfggfdzd��dd�gg�dg�ddĐd�dggfd�d��d�dggfgfggfdzd}�d!dd�ggdggdgf�d"gdĐd�d#dߐd$�d%d�d&�d'gdfgfggfgddfggfdzd}�d!dd�ggdggdgf�d"g�d(gddfggfdz�d)ggfdzd}d~dd�d�ggdggdgfd�ggddfggfdzd}d~dd�d�g�d*�d+�d,gdggdgf�d-ggddfggfdzd}d~dd�d�g�d*gd�d.�d/gddgdgf�d0ggddfggfdzd}d~dd�d�g�d*gd�d.�d/gddg�d1gf�d2ggddfggfdzd}d~dd�d�ggdggd�d3gfd�ggddfggfdzd}d~dd�d�g�d4�d5gdggd�d3�d6�d7gf�d0ggddfggfdzd}d~dd�d�g�d4gd�d8g�d9gd�d3�d6gf�d:ggddfggfdzd}d~dd�d�g�d4gd�d8gdgd�d3�d6gf�d;ggddfggfdzd}d~dd�d�g�d4gd�d8g�d9g�d<�d3�d6gf�d=ggddfggfdzd}d~dd�d�g�d4gd�d8gdg�d>�d3�d6gf�d?ggddfggfgCZ�d@�dAgfgZ�dB�dC�dDd~�dE�dF�dGgff�dH�dI�dC�dJd~d�ggdggdgf�dKff�dCd�d~�dLg�dMgff�dCd�d~ggff�dC�dd~�dNgff�dCd�d~�dOg�dPgff�dC�dd~d�d�dېdQ�dRgdfgff�dCd�d~d�d�dېdQ�dRgdfgff�dC�dd~d��d�dS�dTgd�fd�d�d�dU�dVgd�f�dWgdfgff�dC�dd~d��d�dS�dTgd�fd�d�d�d&�dXgd�f�dYgdfgff�dC�dd~d��d�dS�dTgd�fd�d�d�d&�dXgd�f�dYgdfgff�dCd�d~d��d�dS�dTgd�fd�d�d�dU�dVgd�f�dWgdfgff�dCd�d~d��d�dS�dTgd�fd�d�d�d&�dXgd�f�dYgdfgff�dCd�d~d��d�dS�dTgd�fd�d�d�d&�dXgd�f�dYgdfgff�dCd�d~d��d�dS�dTgd�fd�d�d�dU�dVgd�f�dWgdfgff�dCd�d~d��d�dS�dTgd�fd�d�d�d&�dXgd�f�dYgdfgff�dCd�d~d��d�dS�dTgd�fd�d�d�d&�dXgd�f�dYgdfgff�dC�dZd~�d[�d\�d\g�dM�d]gff�dCd�d~�d^�dL�dM�d_g�d`�dagff�dCd�d~�d^�d�dd��d�db�dcgd�fd�fggff�dCd�d~�d^dߐd�dSd�dd�degdfgfggff�df�dg�dh�di�dj�dCd�d~�dk�dl�dmgd�ff�dCd�d~gd�ff�dCd�d~�d[�dn�dogd�ff�dCd�d~�dk�dl�dmgd�ff�dCd�d~gd�ff�dCd�d~�dp�dqggffg#Ze�dS(r�N)�dedent)�supportcCs�|dkst|tttf�r|St|t�r4dd�|D�S|jjg}t|d�rdt|d�rd|�|j	|j
f�|jdkrvt|�S|jD]}|�t
t||���q|t|�S)NcSsg|]}t|��qS�)�to_tuple)�.0�err�2/opt/alt/python38/lib64/python3.8/test/test_ast.py�
<listcomp>szto_tuple.<locals>.<listcomp>�lineno�
col_offset)�
isinstance�str�int�complex�list�	__class__�__name__�hasattr�appendr
r�_fields�tupler�getattr)�t�result�frrrrs



r�Nonez'module docstring'z
def f(): passzdef f(): 'function docstring'zdef f(a): passzdef f(a=0): passzdef f(*args): passzdef f(**kwargs): passzGdef f(a, b=1, c=None, d=[], e={}, *args, f=42, **kwargs): 'doc for f()'zclass C:passz class C: 'docstring for class C'zclass C(object): passzdef f():return 1zdel v�v = 1za,b = cz	(a,b) = cz	[a,b] = czv += 1zfor v in v:passzwhile v:passz	if v:passzif a:
  pass
elif b:
  passz(if a:
  pass
elif b:
  pass
else:
  passzwith x as y: passzwith x as y, z as q: passzraise Exception('string')z$try:
  pass
except Exception:
  passztry:
  pass
finally:
  passzassert vz
import syszfrom sys import vzglobal v�1�passzfor v in v:breakzfor v in v:continuezfor a,b in c: passzfor (a,b) in c: passzfor [a,b] in c: passzL(
    (
    Aa
    ,
       Bb
    )
    for
    Aa
    ,
    Bb in Cc
    )z"{a : b for w in x for m in p if g}z{a : b for v,w in x}z{r for l in x if g}z{r for l,m in x}z3async def f():
 'async function'
 await something()z,async def f():
 async for e in i: 1
 else: 2z$async def f():
 async with a as b: 1z{**{1:2}, 2:3}z{*{1, 2}, 3}z$async def f():
 [i async for b in c]z'@deco1
@deco2()
@deco3(1)
def f(): passz-@deco1
@deco2()
@deco3(1)
async def f(): passz'@deco1
@deco2()
@deco3(1)
class C: passz!@deco(a for a in b)
def f(): pass�@a.b.c
def f(): passz(a := 1)zdef f(a, /,): passzdef f(a, /, c, d, e): passzdef f(a, /, c, *, d, e): passz'def f(a, /, c, *, d, e, **kwargs): passzdef f(a=1, /,): passzdef f(a=1, /, b=2, c=4): passz def f(a=1, /, b=2, *, c=4): passzdef f(a=1, /, b=2, *, c): passz*def f(a=1, /, b=2, *, c=4, **kwargs): passz(def f(a=1, /, b=2, *, c, **kwargs): passz1+2za and b�a + bznot vzlambda:Nonez{ 1:2 }�{}z{None,}z&{
      1
        :
          2
     }z[a for b in c if d]z(a for b in c if d)z[(a,b) for a,b in c]z[(a,b) for (a,b) in c]z[(a,b) for [a,b] in c]z{(a,b) for a,b in c}z{(a,b) for (a,b) in c}z{(a,b) for [a,b] in c}z((a,b) for a,b in c)z((a,b) for (a,b) in c)z((a,b) for [a,b] in c)z	1 < 2 < 3zf(1,2,c=3,*d,**e)�
f(*[0, 1])zf(a for a in b)Z10z'string'�a.bza[b:c]�vz[1,2,3]z[]z1,2,3z(1,2,3)�()za.b.c.d(a.b[1:2])c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zejd/d0��Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9S):�	AST_TestscCs�t|tj�r|jdkrdSt|tjtjtjf�rT|j|jf}|�	||�|j|jf}|jD]h}t
||�}t|t�r�|}|r�|dkr�|dj|djf}|D]}|�||�q�qZ|dk	rZ|�||�qZdS)N�decorator_listr)
r�ast�ASTr�expr�stmtZ
excepthandlerr
rZassertGreaterEqualrr�_assertTrueorder)�self�ast_nodeZ
parent_posZnode_pos�name�valueZ	first_posZchildrrrr,�s 


zAST_Tests._assertTrueorderc	Cs|t��}|�|jd�d|_|�|jd�|�|jdd�|�t��|jW5QRX|�t	��t�d�W5QRXdS)Nr�*�foobar�)
r(r)�assertEqualrr2�__dict__�assertRaises�AttributeError�vararg�	TypeError�r-�xrrr�test_AST_objects
szAST_Tests.test_AST_objectscCsLGdd�d�}t��}|�|_||j_t�|j�}~t��|�|��dS)Nc@seZdZdS)z0AST_Tests.test_AST_garbage_collection.<locals>.XN�r�
__module__�__qualname__rrrr�Xsr@)	r(r)r;�a�weakref�refrZ
gc_collect�assertIsNone)r-r@rArCrrr�test_AST_garbage_collectionsz%AST_Tests.test_AST_garbage_collectioncCs�ttdfttdfttdffD]�\}}}t||�D]v\}}|jd|d��2t|d|t	j
�}|�t|�|�|�
|d�W5QRX|jd||d	��t|d|�W5QRXq0qdS)
N�exec�single�evalZparsing)�action�input�?)rrZ	compiling)rIrJ�kind)�
exec_tests�exec_results�single_tests�single_results�
eval_tests�eval_results�zip�subTest�compiler(�
PyCF_ONLY_ASTr4rr,)r-rJ�outputrL�i�oZast_treerrr�
test_snippets#s�zAST_Tests.test_snippetscCs0ttt}|D]}t�|�}t|dd�qdS)N�<string>rF)rMrOrQr(�parserU)r-Zsnippets_to_validateZsnippet�treerrr�test_ast_validation/s
zAST_Tests.test_ast_validationcCs<t�d�jdjj}|�|j�|�|j�|�|j�dS)Nzx[::]r)	r(r\�bodyr0�slicerD�upper�lower�step)r-Zslcrrr�
test_slice6szAST_Tests.test_slicecCs t�d�jd}|�|j�dS)Nzfrom . import yr)r(r\r_rD�module)r-�imrrr�test_from_import<szAST_Tests.test_from_importcCs>t�d�}|�|jdtj�d��|jd_t|dd�dS)Nzfrom __future__ import divisionrz __future__ �<test>rF)r(r\ZassertIsInstancer_�
ImportFrom�striprerU)r-�modrrr�!test_non_interned_future_from_ast@s
z+AST_Tests.test_non_interned_future_from_astcCs||�ttjtj��|�ttjtj��|�ttjtj��|�ttjtj��|�ttjtj��|�ttj	tj��dS�N)
�
assertTrue�
issubclassr(�Forr+�Namer*r)�
comprehensionZGt�r-rrr�test_base_classesFszAST_Tests.test_base_classescCsZtj��D]J\}}t|t�r
|dkr
|d��r
|�}t|tj�r
|�t|j�t	�q
dS)Nr)r)
r(r5�itemsr�type�isupperr)r4rr)r-r/�itemr;rrr�test_field_attr_existenceNs
z#AST_Tests.test_field_attr_existencec	CsTt��}|�|jd�|�t��|jW5QRXtjtdd��}|�|jd�dS)N)�posonlyargs�argsr8�
kwonlyargs�kw_defaults�kwarg�defaults���)r(�	argumentsr4rr6r7r8�ranger:rrr�test_argumentsUszAST_Tests.test_argumentscCs t��}d|_|�|jd�dS)Ni�)r(�Numrr4r:rrr�test_field_attr_writable`sz"AST_Tests.test_field_attr_writablec	Cst��}|�|jd�|�t��|jW5QRX|�t��|jW5QRXt�d�}|�|jd�|�|jd�|�t��|jW5QRX|�t��|j	W5QRXtjdd�}|�|jd�tjddd�}|�|jd�|�|jd�|�|jd�|�|jd�|�t
tjddd�|jt
tjddddd�|�tjddd�jd�|�tjddd�jd�|�
t
d	��tjddd
�W5QRX|�
t
d��tjddd�W5QRX|�t�d�jd�|�t�d
�jd
�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d
�jd
�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�|�t�d�jd�dS)N)r0rLr1r3�r
rr�Zbar)�fooz(Num got multiple values for argument 'n'��nz1Constant got multiple values for argument 'value'�r0�@�@�42�42TF.)r(r�r4rr6r7r0r�r
r2r9�Constantr��assertRaisesRegex�Str�s�Bytes�assertIs�NameConstantr:rrr�test_classattrsfsZ
zAST_Tests.test_classattrscCs�|�tt�d��tj�|�tt�d��tj�|�tt�d��tj�|�tt�d��tj�|�tt�d��tj�|�tt�d��tj�|�tt�d��tj�|�tt�d��tj�|�tt���tj�dS)Nr1r�r�r�r�TF)	r4rvr(r�r�r�r�r��Ellipsisrsrrr�
test_realtype�szAST_Tests.test_realtypecCs�|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt��tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt�d�tj��|�	tt��tj��|�	tt��tj��|�	tt��tj��|�	tt��tj��|�	tt��tj��Gd	d
�d
t
�}|�tt�|d��tj��|�	tt�|d��tj��dS)Nr1g������@y������@r�r�TF.c@seZdZdS)z$AST_Tests.test_isinstance.<locals>.SNr=rrrr�S�sr�)rnrr(r�r�r�r�r�r��assertFalser
)r-r�rrr�test_isinstance�sPzAST_Tests.test_isinstancecCs�Gdd�dtj�}Gdd�dtj�}|d�}|�|jd�|�|jd�|�t|�|�|�t||��|�t|tj��|�t||��|�tt�d�|��|dd�}|�|jd�|�t|�|�dS)NcseZdZ�fdd�Z�ZS)z$AST_Tests.test_subclasses.<locals>.Ncst�j||�d|_dS)N�spam)�super�__init__�z)r-r{�kwargs�rrrr��sz-AST_Tests.test_subclasses.<locals>.N.__init__)rr>r?r��
__classcell__rrr�r�N�sr�c@seZdZdS)z%AST_Tests.test_subclasses.<locals>.N2Nr=rrrr�N2�sr�r1r�r�)	r(r�r4r�r�rvrnrr�)r-r�r�r�rrr�test_subclasses�s
zAST_Tests.test_subclassescCs*t�d�g}t�|g�}|�|j|�dS)Nr1)r(r��Moduler4r_)r-r_r;rrr�test_module�szAST_Tests.test_modulec	Cs�t��}|�|jd�d|_|�|jd�t�d�}t�d�}t��}t�|||�}|�|j|�|�|j|�|�|j	|�t�ddd�}|�|jd�|�|jd�|�|j	d�tjddddd�}|�|jd�|�|jd�|�|j	d�|�|j
d�|�ttjdddd�|jttjdddddd�tjddddd	�}|�|jd�|�|jd�|�|j	d�|�|j
d�tjdddd
d�}|�|jd
�dS)N)�left�op�right�r�r�r3rr��)r�r�r�r
r1)�	foobarbaz)
r(�BinOpr4rr�r��Addr�r�r�r
r6r9)r-r;Zn1Zn3Zaddoprrr�test_nodeclasses�s:

zAST_Tests.test_nodeclassescCst��}|�|jd�dS)Nr)r(ZSubr4rr:rrr�test_no_fields!szAST_Tests.test_no_fieldsc		Cs�ddl}|g}zddl}|�|�Wntk
r8YnXdddg}|D]H}|D]>}dd�tD�D]*}|�|�||��}|�t|�t|��qbqPqHdS)Nrr�r3css|]}t|ddd�VqdS)rKrFiN)rU)rrXrrr�	<genexpr>1sz*AST_Tests.test_pickling.<locals>.<genexpr>)	�pickle�cPickler�ImportErrorrM�loads�dumpsr4r)	r-r�Zmodsr�Z	protocolsrkZprotocolr(Zast2rrr�
test_pickling&s
zAST_Tests.test_picklingc	Csdtddd�}t�tjtjf|�f|�gg�}|�t��}t|dd�W5QRX|�dt	|j
��dS)Nr3r��r
rrhrFzbut got <_ast.expr)�dictr(r��Exprr*r6r9rU�assertInr
�	exception)r-�pos�m�cmrrr�test_invalid_sum5s
 zAST_Tests.test_invalid_sumc	Csbt�t�t�dt����gg�}t�|�|�t��}t|dd�W5QRX|�	dt
|j��dS)Nr1rhrFzidentifier must be of type str)r(r�r�rq�Load�fix_missing_locationsr6r9rUr�r
r�)r-r�r�rrr�test_invalid_identitifer<s
 
z"AST_Tests.test_invalid_identitiferc	CsVt�d�}d|jdjdj_|�t��}t|dd�W5QRX|�dt|j	��dS)Nzdef f():
 yield from g()rrhrFzfield value is required)
r(r\r_r0r6�
ValueErrorrUr�r
r�)r-Zempty_yield_fromr�rrr�test_empty_yield_fromCs

zAST_Tests.test_empty_yield_fromc	Cs>ddl}dd�}t�|d|��|�ttjd�W5QRXdS)NrcWsdSrmr�r{rrr�
bad_normalizePsz0AST_Tests.test_issue31592.<locals>.bad_normalize�	normalizeuϕ)�unicodedatarZ	swap_attrr6r9r(r\)r-r�r�rrr�test_issue31592KszAST_Tests.test_issue31592cCsDt�d�}|jdj}|j}|j}|�|jd�|�|jd�|�|jd�|�|jd�|�|jd�|�|jd�t�d�}|jdj}|j}|j}|�|jd�|�|jd�|�|jd�|�|j	d	�|�|jd�|�|jd�|�|jd	�|�|j	d	�|�|jd�|�|jd�|�|jd�|�|j	d�dS)
Nz4+5+6+7r�r�r�z
4+5-\
 6-7r�r�r3)
r(r\r_r0r�r4r�end_col_offsetr
�
end_lineno)r-r]Zparent_binopZchild_binopZgrandchild_binoprrr� test_issue18374_binop_col_offsetUs4

z*AST_Tests.test_issue18374_binop_col_offsetcCs.t�d�}|jdjdj}|�|jd�dS)Nrrr�)r(r\r_r'r0r4r�)r-r]Zattr_brrr�*test_issue39579_dotted_name_end_col_offsetts
z4AST_Tests.test_issue39579_dotted_name_end_col_offsetc	Cs6tjddd�|�t��tjddd�W5QRXdS)Nzf"{x=}")r�r�)Zfeature_version�r�r�)r(r\r6�SyntaxErrorrsrrr�test_issue40614_feature_versionysz)AST_Tests.test_issue40614_feature_versionc
CsZdD]P}t�t�|t����}t�|�|�td|�d���t|dd�W5QRXqdS)N)�True�FalserzName node can't be used with 'z
' constantrhrH)r(�
Expressionrqr�r�r�r�rU)r-Zconstantr*rrr�test_constant_as_name~s

zAST_Tests.test_constant_as_nameN)!rr>r?r,r<rErZr^rdrgrlrtryr�r�r�r�r�r�r�r�r�r�r�r�r�r�cpython_onlyr�r�r�r�r�rrrrr&�s:</,
	r&c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZdS),�ASTHelpers_TestNcCs6t�d�}tdddtj�}|�t�|�t�|��dS)Nz
foo(1 + 1)z	<unknown>rF)r(r\rUrVr4�dump)r-rA�brrr�
test_parse�s
zASTHelpers_Test.test_parsecCsTzddWnBtk
rN|�t��}t�d�W5QRX|�|jj�YnXdS)Nr�rz'\U')�	Exceptionr6r�r(�literal_evalZassertIsNotNoner��__context__�r-rrrr�test_parse_in_error�sz#ASTHelpers_Test.test_parse_in_errorcCsLt�d�}|�t�|�d�|�tj|dd�d�|�tj|dd�d�dS)	Nzspam(eggs, "and cheese")z�Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), args=[Name(id='eggs', ctx=Load()), Constant(value='and cheese', kind=None)], keywords=[]))], type_ignores=[])F��annotate_fieldszhModule([Expr(Call(Name('spam', Load()), [Name('eggs', Load()), Constant('and cheese', None)], []))], [])T��include_attributesa�Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, col_offset=0, end_lineno=1, end_col_offset=4), args=[Name(id='eggs', ctx=Load(), lineno=1, col_offset=5, end_lineno=1, end_col_offset=9), Constant(value='and cheese', kind=None, lineno=1, col_offset=11, end_lineno=1, end_col_offset=23)], keywords=[], lineno=1, col_offset=0, end_lineno=1, end_col_offset=24), lineno=1, col_offset=0, end_lineno=1, end_col_offset=24)], type_ignores=[]))r(r\r4r��r-�noderrr�	test_dump�s
���zASTHelpers_Test.test_dumpcCs�tjddd�}|�t�|�d�|�tj|dd�d�tjtjdt��d	�ddd
�}|�t�|�d�|�tj|dd
�d�|�tj|dd�d�|�tj|ddd�d�tjtjdt��d	�d�}|�t�|�d�|�tj|dd
�d�dS)Nr�r�r�zRaise()Tr�zRaise(lineno=3, col_offset=4)r)�idZctx)�excr
rz#Raise(exc=Name(id='e', ctx=Load()))Fr�zRaise(Name('e', Load()))z;Raise(exc=Name(id='e', ctx=Load()), lineno=3, col_offset=4))r�r�z0Raise(Name('e', Load()), lineno=3, col_offset=4))�causez%Raise(cause=Name(id='e', ctx=Load()))zRaise(cause=Name('e', Load())))r(�Raiser4r�rqr�r�rrr�test_dump_incomplete�s6��������z$ASTHelpers_Test.test_dump_incompletec	Cs�tjddd�}t�t�d�|jj�|j_|�tj|dd�d�tjddddd	�}t�|tjddddd	��}|�	|j
�|�	|j�|�|jd�|�|j
d�dS)
N�1 + 1rH��moder3Tr�aExpression(body=BinOp(left=Constant(value=1, kind=None, lineno=1, col_offset=0, end_lineno=1, end_col_offset=1), op=Add(), right=Constant(value=2, lineno=1, col_offset=4, end_lineno=1, end_col_offset=5), lineno=1, col_offset=0, end_lineno=1, end_col_offset=5))r�)rr
r�r�)r(r\�
copy_locationr�r_r�r4r��CallrDr�r�r
r)r-�src�newrrr�test_copy_location�s �
�z"ASTHelpers_Test.test_copy_locationcCslt�d�}|j�t�t�t�dt���t�d�gg���|�	|t�
|��d|_|�	tj|dd�d�dS)Nz
write("spam")r�ZeggsTr�a�Module(body=[Expr(value=Call(func=Name(id='write', ctx=Load(), lineno=1, col_offset=0, end_lineno=1, end_col_offset=5), args=[Constant(value='spam', kind=None, lineno=1, col_offset=6, end_lineno=1, end_col_offset=12)], keywords=[], lineno=1, col_offset=0, end_lineno=1, end_col_offset=13), lineno=1, col_offset=0, end_lineno=1, end_col_offset=13), Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, col_offset=0, end_lineno=1, end_col_offset=0), args=[Constant(value='eggs', lineno=1, col_offset=0, end_lineno=1, end_col_offset=0)], keywords=[], lineno=1, col_offset=0, end_lineno=1, end_col_offset=0), lineno=1, col_offset=0, end_lineno=1, end_col_offset=0)], type_ignores=[]))
r(r\r_rr�r�rqr�r�r4r��maxDiffr��r-r�rrr�test_fix_missing_locations�s

��z*ASTHelpers_Test.test_fix_missing_locationscCs�tjddd�}|�tj|dd�|�|�tj|dd�d�tjddd�}|�tj|jdd�|j�|�tj|dd�d�tjt�d	t���ggd
dd�}|�t�|�j	d�|�
t�|�j�dS)
Nr�rHr�r�r�Tr�aExpression(body=BinOp(left=Constant(value=1, kind=None, lineno=4, col_offset=0, end_lineno=4, end_col_offset=1), op=Add(), right=Constant(value=1, kind=None, lineno=4, col_offset=4, end_lineno=4, end_col_offset=5), lineno=4, col_offset=0, end_lineno=4, end_col_offset=5))�testr�)�funcr{�keywordsr
r�r3)r(r\r4Zincrement_linenor�r_r�rqr�r
rDr�r�rrr�test_increment_lineno�s&���z%ASTHelpers_Test.test_increment_linenocCsHtjddd�}tt�|j��}|�|�d�jd�|�|ggd��dS)N�foo()rHr�r�r�)r�r{)r(r\r�Ziter_fieldsr_r4�popr�)r-r��drrr�test_iter_fieldssz ASTHelpers_Test.test_iter_fieldscCs�tjddd�}|�ttt�|j���d�t�|j�}|�t|�jd�|�t|�j	d�|�t|�j	d�|�t�
t|��d�dS)	Nzspam(23, 42, eggs='leek')rHr�r�r��r1z<keyword(arg='eggs', value=Constant(value='leek', kind=None)))r(r\r4�lenrZiter_child_nodesr_�nextr�r0r�)r-r��iteratorrrr�test_iter_child_nodess�z%ASTHelpers_Test.test_iter_child_nodescCs�t�d�}|�t�|�d�t�d�}|�t�|jd�d�t�d�}|�t�|jd�d�t�d�}|�t�|jd�d�dS)Nz"""line one
  line two"""zline one
line twoz&class foo:
  """line one
  line two"""rz&def foo():
  """line one
  line two"""z#async def foo():
  """spam
  ham"""zspam
ham)r(r\r4�
get_docstringr_r�rrr�test_get_docstrings
�
�
�
z"ASTHelpers_Test.test_get_docstringcCs.|�t�t�d���t�d�}|�t�|��t�d�}|�t�|��t�d�}|�t�|jd��t�d�}|�t�|jd��t�d�}|�t�|jd��t�d�}|�t�|jd��t�d�}|�t�|jd��t�d	�}|�t�|jd��t�d
�}|�t�|jd��dS)N�zx = "not docstring"zdef foo():
  passzclass foo:
  passrz class foo:
  x = "not docstring"z class foo:
  def bar(self): passz def foo():
  x = "not docstring"zasync def foo():
  passz&async def foo():
  x = "not docstring")rDr(rr\r_r�rrr�test_get_docstring_none)s&








z'ASTHelpers_Test.test_get_docstring_nonecCst�d�}|�|jdjd�|�|jdjd�|�|jdjdjd�|�|jdjdjd�|�|jdjdjdjd�|�|jdjdjdjd�|�|jdjdjd�|�|jdjdjd�|�|jdjd�|�|jdjd	�dS)
Nz�"""line one
line two"""

def foo():
  """line one
  line two"""

  def bar():
    """line one
    line two"""
  """line one
  line two"""
"""line one
line two"""

rr�r3r�r��	��
)r(r\r4r_rr
r�rrr�:test_multi_line_docstring_col_offset_and_lineno_issue16806As�  zJASTHelpers_Test.test_multi_line_docstring_col_offset_and_lineno_issue16806cCs:t�d�}|jdjd}|�|jd�|�|jd�dS)Nz if a:
    pass
elif b:
    pass
rr��r(r\r_�orelser4r
r�r-r�Z	elif_stmtrrr�test_elif_stmt_start_positionTs
z-ASTHelpers_Test.test_elif_stmt_start_positioncCs:t�d�}|jdjd}|�|jd�|�|jd�dS)Nz/if a:
    pass
elif b:
    pass
else:
    pass
rr�rrrrr�'test_elif_stmt_start_position_with_elseZs
z7ASTHelpers_Test.test_elif_stmt_start_position_with_elsecCs<t�d�}|jdjjd}|�|jd�|�|jd�dS)Nr"rr�r)r(r\r_r0r{r4r�r�)r-r�Zstarred_exprrrr�*test_starred_expr_end_position_within_call`s
z:ASTHelpers_Test.test_starred_expr_end_position_within_callcCs0|�t�d�dddg�|�t�d�ddi�|�t�d�d	�|�t�d
�dddh�|�t�d�d�|�ttjd
�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�tt�d��d�|�ttjd�|�ttjd�|�ttjd�dS)Nz	[1, 2, 3]r�r3r�z{"foo": 42}r�r1z(True, False, None))TFNz	{1, 2, 3}zb"hi"shir��6�z+6z-6i����z3.25g
@z+3.25z-3.25g
�z-0.0z++6z+Truez2+3)r4r(r�r6r��reprrsrrr�test_literal_evalfs z!ASTHelpers_Test.test_literal_evalc
Csht�d��Tt�d�|�t��}t�d�W5QRX|�dt|j��|�dt|j��W5QRXdS)Ni�A�3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333A�33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333zExceeds the limit z Consider hexadecimal )	rZadjust_int_max_str_digitsr(r�r6r�r�r
r�)r-Zerr_ctxrrr�test_literal_eval_str_int_limitxs
z/ASTHelpers_Test.test_literal_eval_str_int_limitcCs>|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d	�d
�|�t�d�d�|�t�d
�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d�|�t�d�d
�|�ttjd�|�ttjd�|�ttjd�|�ttjd�|�ttjd�dS)NZ6jy@z-6jy��z6.75jy@z-6.75jy��z3+6jy@@z-3+6jy�@z3-6jy@�z-3-6jy��z
3.25+6.75jy
@@z-3.25+6.75jy
�@z
3.25-6.75jy
@�z-3.25-6.75jy
��z(3+6j)z-6j+3z-6j+3jz3+-6jz3+(0+6j)z-(3+6j))r4r(r�r6r�rsrrr�test_literal_eval_complex�s$z)ASTHelpers_Test.test_literal_eval_complexcCsptjt�d�t�d�gt�d�gd�}|�ttj|�tjt�d�gt�d�t�d�gd�}|�ttj|�dS)Nr�r3r�)�keys�values)r(�Dictr�r6r�r�)r-Z	malformedrrr�&test_literal_eval_malformed_dict_nodes�s&&z6ASTHelpers_Test.test_literal_eval_malformed_dict_nodesc	Csdtjdtjdd�gdddd�g}t�|g�}|�t��}t|dd�W5QRX|�dt|j	��dS)N�time�sleep�r/�re�names�levelr
rr�rFzinvalid integer value: None)
r(ri�aliasr�r6r�rUr�r
r�)r-r_rkr�rrr�test_bad_integer�s�z ASTHelpers_Test.test_bad_integercCsVtjdtjdd�gdddd�g}t�|g�}t|dd�}i}t||�|�d|�dS)Nr r!r"rr#r�rF)r(rir&r�rUrFr�)r-r_rk�code�nsrrr�test_level_as_none�s�
z"ASTHelpers_Test.test_level_as_none)rr>r?r�r�r�r�r�r�r�r�rrr	rrrrrrrrrr'r*rrrrr��s,r�c@s�eZdZd`ed�dd�Zdaed�dd�Zdbdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dBdC�Z#dDdE�Z$dFdG�Z%dHdI�Z&dJdK�Z'dLdM�Z(dNdO�Z)dPdQ�Z*dRdS�Z+dTdU�Z,dVdW�Z-dXdY�Z.dZd[�Z/d\d]�Z0d^d_�Z1dS)c�ASTValidatorTestsNrF�r�c	Csdd|_|_t�|�|dkr,t|d|�n4|�|��}t|d|�W5QRX|�|t|j��dS)Nrrh)	r
rr(r�rUr6r�r
r�)r-rk�msgr�r�r�rrrrk�s
zASTValidatorTests.modcCs(t�t�|�gg�}|j|||d�dS)Nr,)r(r�r�rk)r-r�r-r�rkrrrr*�szASTValidatorTests.exprcCst�|gg�}|�||�dSrm)r(r�rk)r-r+r-rkrrrr+�szASTValidatorTests.stmtc	CsTt�t�t�dt����g�}|�|dd�t�t�dt����}|�|dd�dS)Nr;�must have Load contextrGrH)r(�Interactiver�rq�Storerkr�)r-r�rrrr��szASTValidatorTests.test_modulec	sd�fdd�	}t�dt�dt����g}|||d�d�|||d�d�|||d�d�||t�d�gd	�d
�||t�d�gd�d
�t�dt�dt����g}|||t�dt���gd�d�t�dt�dt����t�dt�dt����g}|||dt�dt���gd�d�dS)Nc	sZ|dkrg}|dkrg}|dkr$g}|dkr0g}|dkr<g}t�|||||||�}�|�Srm)r(r�)r{rzr8r|r~rr}��facrrr��s �z5ASTValidatorTests._check_arguments.<locals>.argumentsr;r�r.)rz)r|r�)rz"more positional defaults than argsr�)r}z3length of kwonlyargs is not the same as kw_defaults)r{rrAr��y)r|r})NNNNNNN)r(�argrqr0r�r�)r-r2Zcheckr�r{rr1r�_check_arguments�s8�������z"ASTValidatorTests._check_argumentscCs�t�ggdggdg�}t�d|ggd�}|�|d�t�d|t��gt�dt���gd�}|�|d�t�d|t��ggt�dt����}|�|d�dd�}|�||j�dS)Nr;zempty body on FunctionDefr.cSst�d|t��ggd�S�Nr;)r(�FunctionDef�Passr�rrrr2�sz+ASTValidatorTests.test_funcdef.<locals>.fac)r(r�r7r+r8rqr0r5)r-rArr2rrr�test_funcdef�s ��zASTValidatorTests.test_funcdefcCs�ddd�}|�|t�dt���gd�d�|�|t�dt�dt����gd�d�|�|gd�d�|�|dgd�d	�|�|t�dt���gd
�d�dS)NcSsH|dkrg}|dkrg}|dkr*t��g}|dkr6g}t�d||||�S)NZmyclass)r(r8�ClassDef)�basesr�r_r'rrr�cls�s

�z,ASTValidatorTests.test_classdef.<locals>.clsr;)r;r.)r�)r_zempty body on ClassDef�None disallowed)r')NNNN)r+r(rqr0�keyword)r-r<rrr�
test_classdef�s
�"��zASTValidatorTests.test_classdefc	CsJ|�t�g�d�|�t�dg�d�|�t�t�dt���g�d�dS)Nzempty targets on Deleter=r;zmust have Del context)r+r(�Deleterqr�rsrrr�test_deletes
�zASTValidatorTests.test_deletec
Cs�|�t�gt�d��d�|�t�dgt�d��d�|�t�t�dt���gt�d��d�|�t�t�dt���gt�dt����d�dS)Nr�zempty targets on Assignr=r;�must have Store contextr3r.)r+r(�Assignr�rqr�r0rsrrr�test_assigns"���zASTValidatorTests.test_assignc	Cspt�t�dt���t��t�dt����}|�|d�t�t�dt���t��t�dt����}|�|d�dS)Nr;r3rBr.)r(�	AugAssignrqr�r�r+r0)r-Zaugrrr�test_augassign s��z ASTValidatorTests.test_augassignc
Cs�t�dt���}t�dt���}t��}|�t�||gg�d�|�t�t�dt���||gg�d�|�t�|t�dt���|gg�d�t�t�dt����}|�t�|||gg�d�|�t�|||g|g�d�dS)Nr;r3zempty body on ForrBr.)r(rqr0r�r8r+rpr�)r-r;r3�prrrr�test_for(s � �zASTValidatorTests.test_forc
Cs~|�t�t�d�gg�d�|�t�t�dt���t��gg�d�|�t�t�d�t��gt�t�dt����g�d�dS)Nr�zempty body on Whiler;r.)r+r(�Whiler�rqr0r8r�rsrrr�
test_while5s"���zASTValidatorTests.test_whilecCs�|�t�t�d�gg�d�t�t�dt���t��gg�}|�|d�t�t�d�t�t�dt����gg�}|�|d�t�t�d�t��gt�t�dt����g�}|�|d�dS)Nr�zempty body on Ifr;r.)r+r(�Ifr�rqr0r8r�)r-rXrrr�test_if=s (�zASTValidatorTests.test_ifcCs�t��}|�t�g|g�d�t�t�d�d�}|�t�|gg�d�t�t�dt���d�}|�t�|g|g�d�t�t�d�t�dt����}|�t�|g|g�d�dS)Nzempty items on Withr�zempty body on Withr;r.rB)	r(r8r+�With�withitemr�rqr0r�)r-rGrXrrr�	test_withGszASTValidatorTests.test_withcCspt�dt�d��}|�|d�t�t�dt���d�}|�|d�t�t�d�t�dt����}|�|d�dS)Nr�z!Raise with cause but no exceptionr;r.r�)r(r�r�r+rqr0)r-�rrrr�
test_raiseQszASTValidatorTests.test_raisecCsxt��}t�ggg|g�}|�|d�t�t�t�dt����ggg|g�}|�|d�t�|gggg�}|�|d�t�|gg|g|g�}|�|d�t�|gt�ddg�ggg�}|�|d�t�t�dt���d|g�g}|�t�|g|gg�d�t�dd|g�g}t�|g|t�t�dt����g|g�}|�|d�t�|g||gt�t�dt����g�}|�|d�dS)Nzempty body on Tryr;r.z-Try has neither except handlers nor finalbodyz%Try has orelse but no except handlerszempty body on ExceptHandlerr3)r(r8�Tryr+r�rqr0�
ExceptHandler)r-rGrrrrr�test_tryYs$&((zASTValidatorTests.test_tryc	CsT|�t�t�dt���d�d�t�t�dt���t�dt����}|�|d�dS)Nr;r.r3)r+r(�Assertrqr0r�)r-Zassrtrrr�test_assertms��zASTValidatorTests.test_assertcCs|�t�g�d�dS)Nzempty names on Import)r+r(�Importrsrrr�test_importtszASTValidatorTests.test_importcCs>t�dt�dd�gd�}|�|d�|�t�dgd�d�dS)Nr;i���zNegative ImportFrom levelrzempty names on ImportFrom)r(rir&r+)r-�imprrr�test_importfromwsz!ASTValidatorTests.test_importfromcCs|�t�g�d�dS)Nzempty names on Global)r+r(�Globalrsrrr�test_global|szASTValidatorTests.test_globalcCs|�t�g�d�dS)Nzempty names on Nonlocal)r+r(ZNonlocalrsrrr�
test_nonlocalszASTValidatorTests.test_nonlocalcCs&t�t�dt����}|�|d�dS�Nr;r.)r(r�rqr0r+r�rrr�	test_expr�szASTValidatorTests.test_exprc	Cs�t�t��g�}|�|d�t�t��t�d�g�}|�|d�t�t��t�d�dg�}|�|d�t�t��t�d�t�dt���g�}|�|d�dS)Nzless than 2 valuesr�r�r=r;r.)r(�BoolOp�Andr*r�rqr0)r-r�rrr�test_boolop�s&zASTValidatorTests.test_boolopcCs,t�t��t�dt����}|�|d�dSr^)r(�UnaryOp�Notrqr0r*)r-�urrr�test_unaryop�szASTValidatorTests.test_unaryopc
CsPt�ggdggdg�}|�t�|t�dt����d�dd�}|�||j�dS)Nr;r.cSst�|t�dt����Sr6)r(�Lambdarqr�r�rrrr2�sz*ASTValidatorTests.test_lambda.<locals>.fac)r(r�r*rgrqr0r5)r-rAr2rrr�test_lambda�s�zASTValidatorTests.test_lambdacCsXt�dt���}t�dt���}|||f|||f|||ffD]}|�tj|�d�q<dS�Nr;r3r.)r(rqr�r0r*ZIfExp)r-�lr�r{rrr�
test_ifexp�s zASTValidatorTests.test_ifexpcCsRt�gt�dt���g�}|�|d�t�t�dt���gdg�}|�|d�dS)Nr;zsame number of keys as valuesr=)r(rrqr�r*)r-rrrr�	test_dict�szASTValidatorTests.test_dictcCs<|�t�dg�d�t�t�dt���g�}|�|d�dS�Nr=r;r.)r*r(�Setrqr0�r-r�rrr�test_set�szASTValidatorTests.test_setc	Cs�|�|g�d�t�t�dt���t�dt���gd�}|�||g�d�t�t�dt���t�dt���gd�}|�||g�d�t�dt���}t�dt���}t�||dgd�}|�||g�d�t�||t�dt���gd�}|�||g�d�dS)Nz comprehension with no generatorsr;rrBr.r3r=)r*r(rrrqr�r0)r-r2�gr;r3rrr�_check_comprehension�s&��z&ASTValidatorTests._check_comprehensioncsbt�t�dt���t�dt���gd�}|��t�dt���|g�d��fdd�}|�|�dS)Nr;rr.cs�t�dt���|�Sr6)r(rqr0)Zgensr1rr�wrap�sz,ASTValidatorTests._simple_comp.<locals>.wrap)r(rrrqr0r�r*rr)r-r2rqrsrr1r�_simple_comp�s��zASTValidatorTests._simple_compcCs|�tj�dSrm)rtr(�ListComprsrrr�
test_listcomp�szASTValidatorTests.test_listcompcCs|�tj�dSrm)rtr(�SetComprsrrr�test_setcomp�szASTValidatorTests.test_setcompcCs|�tj�dSrm)rtr(�GeneratorExprsrrr�test_generatorexp�sz#ASTValidatorTests.test_generatorexpcCs�t�t�dt���t�dt���gd�}t�t�dt���t�dt���|g�}|�|d�t�t�dt���t�dt���|g�}|�|d�dd�}|�|�dS)Nr3rGrr;r.cSs.t�dt���}t�dt���}t�|||�S)Nr;r3)r(rqr��DictComp)�comps�kr$rrr�factory�sz0ASTValidatorTests.test_dictcomp.<locals>.factory)r(rrrqr0r�r{r*rr)r-rq�cr~rrr�
test_dictcomp�s"���zASTValidatorTests.test_dictcompc	Cs@|�t�t�dt����d�|�t�t�dt����d�dS)Nr;zmust have Load)r*r(ZYieldrqr0Z	YieldFromrsrrr�
test_yield�szASTValidatorTests.test_yieldcCs�t�dt���}t�|t��gg�}|�|d�t�|t��gt�d�t�d�g�}|�|d�t�t�d�t��g|g�}|�|�t�|t��gt�d�g�}|�|�dS)Nr;zno comparatorsr�r�z,different number of comparators and operandsZblah)r(rqr��CompareZInr*r�)r-r��comprrr�test_compare�s$
zASTValidatorTests.test_comparecCs�t�dt���}t�dt���g}t�dt�dt����g}t�t�dt���||�}|�|d�t�|dg|�}|�|d�t�dt�dt����g}t�|||�}|�|d�dS)Nr;r3�wr�r.r=)r(rqr�r>r�r0r*)r-r�r{r��callZbad_keywordsrrr�	test_call�szASTValidatorTests.test_callcCszGdd�dt�}Gdd�dt�}Gdd�dt�}dD]}|�t�|��q4|�|�|�fD]}|jt�|�dtd	�qZdS)
Nc@seZdZdS)z*ASTValidatorTests.test_num.<locals>.subintNr=rrrr�subint�sr�c@seZdZdS)z,ASTValidatorTests.test_num.<locals>.subfloatNr=rrrr�subfloat�sr�c@seZdZdS)z.ASTValidatorTests.test_num.<locals>.subcomplexNr=rrrr�
subcomplex�sr�)�0Zhellozinvalid typer,)r�floatrr*r(r�r9)r-r�r�r��objrrr�test_num�szASTValidatorTests.test_numcCs.t�t�dt���dt���}|�|d�dSri)r(�	Attributerqr0r�r*)r-�attrrrr�test_attributesz ASTValidatorTests.test_attributec
Cs t�t�dt���t�t�d��t���}|�|d�t�dt���}t�|t�t�dt����t���}|�|d�t�dt���}|ddfd|dfdd|ffD](}tj|�}|�t�||t���d�q�t�	g�}|�t�||t���d�t�	t�|�g�}|�t�||t���d�dS)Nr;r�r.r3zempty dims on ExtSlice)
r(�	Subscriptrqr0ZIndexr�r�r*�SliceZExtSlice)r-�subr;r�r{Zslrrr�test_subscripts& �� 
�
z ASTValidatorTests.test_subscriptc	CsNt�t�t�dt���t���gt���}t�|gt�d��}|�|d�dS)Nr;r�rB)	r(�List�Starredrqr�r0rCr�r+)r-r��assignrrr�test_starreds
 �zASTValidatorTests.test_starredcCs@|�|dgt���d�|�|t�dt���gt���d�dSrm)r*r(r�rqr0)r-r2rrr�	_sequence s�zASTValidatorTests._sequencecCs|�tj�dSrm)r�r(r�rsrrr�	test_list%szASTValidatorTests.test_listcCs|�tj�dSrm)r�r(�Tuplersrrr�
test_tuple(szASTValidatorTests.test_tuplecCs|�t�d��dS)Nr�)r*r(r�rsrrr�test_nameconstant+sz#ASTValidatorTests.test_nameconstantcCs�tj�tj�}dd�t�|�D�}|�ddg�|D]b}|�|��Ntj�||�}t	|ddd��}|�
�}W5QRXt�||�}t||d�W5QRXq4dS)	NcSsg|]}|�d�r|�qS)z.py)�endswith)r�fnrrrr	0s
z;ASTValidatorTests.test_stdlib_validates.<locals>.<listcomp>ztest/test_grammar.pyztest/test_unpack_ex.pyrPzutf-8)�encodingrF)
�os�path�dirnamer(�__file__�listdir�extendrT�join�open�readr\rU)r-Zstdlib�testsrer��fp�sourcerkrrr�test_stdlib_validates.sz'ASTValidatorTests.test_stdlib_validates)NrF)N)N)2rr>r?r�rkr*r+r�r5r9r?rArDrFrHrJrLrOrQrTrVrXrZr\r]r_rbrfrhrkrlrprrrtrvrxrzr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr+�s\

"	



	r+c@sfeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ejdd��Z
dd�Zdd�ZdS)�
ConstantTestsz$Tests on the ast.Constant node type.cCs\t�d�}|jdj}tj|d�}t�||�||jd_t|dd�}i}t||�|dS)Nzx = 123rr�r[rFr;)r(r\r_r0r�r�rUrF)r-r0r]r��new_noder(r)rrr�compile_constant>s

zConstantTests.compile_constantc	Cs<|�t��}|�dddg�W5QRX|�t|j�d�dS)Nr�r3r�z%got an invalid type in Constant: list)r6r9r�r4r
r�)r-r�rrr�test_validationLs
�zConstantTests.test_validationc
CsJdddtdt�fD]2}|j|d��|�|�}|�||�W5QRXqdS)NFT�)�const)r��	frozensetrTr�r�)r-r�r0rrr�test_singletonsRs
zConstantTests.test_singletonsc
Cs�d}tdh�}td�D]}|df}t|dh�}qddddd	td
�td�||f	}|D]2}|j|d��|�|�}|�||�W5QRXqRdS)
N)r�r�r�r3�{g�^@y�^@�unicode�bytesrr�r�)r�r�rrTr�r4)r-Znested_tupleZnested_frozensetr%rr0rrrr�test_valuesXs"
�
zConstantTests.test_valuesc	Cszt�d�}|jdjd}tjdd�}t�||�||jdjd<|�t��}t|dd�W5QRX|�	t
|j�d�dS)N�x = 1rr�r��stringrFz6expression which can't be assigned to in Store context)r(r\r_Ztargetsr�r�r6r�rUr4r
r�)r-r]�target�
new_targetr�rrr�test_assign_to_constantgs
�z%ConstantTests.test_assign_to_constantcCs t�d�}|�t�|�d�dS)Nz'docstring'
x = 1Z	docstring)r(r\r4r)r-r]rrrr	us
z ConstantTests.test_get_docstringcCs:t|dd�}g}t�|�D]}|jdkr|�|j�q|S)Nr[rFZ
LOAD_CONST)rU�disZget_instructions�opnamerZargval)r-r]�co�constsZinstrrrr�get_load_constys
zConstantTests.get_load_constc	Cs�dddddddddg	}d	�d
d�|D��}|d7}|�tdf�t�|�}|�|�|�|�t|j|�D](\}}tj	|d
�}t�
||j�||_qh|�|�|�|�dS)NTF�|g@y@r�r�)r�r3r��
cSsg|]}d�|��qS)zx={!r})�format)rr�rrrr	�sz1ConstantTests.test_load_const.<locals>.<listcomp>z
x = ...r�)r�r�r�r(r\r4r�rSr_r�r�r0)r-r�r(r]r�r�r�rrr�test_load_const�s0�	
��zConstantTests.test_load_constcCslt�d�}|jdj}tjdd�}t�||j�||_tjdd�}t�||j�||_|�t�	|�d�dS)Nz1 + 2r�
r�y4@y$@4@)
r(r\r_r0r�r�r�r�r4r�)r-r]�binopZnew_leftZ	new_rightrrrr�s
zConstantTests.test_literal_evalcCs�tjddd�j}|�|jd�|�|jd�tjddd�j}|�|jd�|�|jd�tjddd�j}|�|jd�|�|jd�tjddd�j}|�|jd	�|�|jd�dS)
Nz"x"rHr�r;zu"x"rezr"x"zb"x"�x)r(r\r_r4r0rL)r-rrrr�test_string_kind�szConstantTests.test_string_kindN)rr>r?�__doc__r�r�r�r�r�r	r�rr�r�rr�rrrrr�;s

r�c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<S)=�EndPositionTestsz�Tests for end position of AST nodes.

    Testing end positions of nodes requires a bit of extra care
    because of how LL parsers work.
    cCs |�|j|�|�|j|�dSrm)r4r�r�)r-r.r�r�rrr�_check_end_pos�szEndPositionTests._check_end_poscCs|�t�||�|�dSrm)r4r(�get_source_segment)r-r�r.Zcontentrrr�_check_content�szEndPositionTests._check_contentcCst�|�jdjS)Nr)r(r\r_r0rorrr�_parse_value�szEndPositionTests._parse_valuecCsJd}|�|�}|�||jd�|�||jjdd�|�||jjd�dS)Nzlambda x, *y: Nonerrr;r3)r�r�r_r{r8)r-r�Zlamrrrrh�s

zEndPositionTests.test_lambdacCs�td���}t�|�jd}|�|dd�|�||jdd�|�||jjdd�|�||jjdjd�|�||jj	d�|�||jj	jd	�dS)
Nz�
            def func(x: int,
                     *args: str,
                     z: float = 0,
                     **kwargs: Any) -> bool:
                return True
            rr��zreturn Truezx: intrzkwargs: AnyZAny)
rrjr(r\r_r�r�r{Z
annotationr~�r-r�Zfdefrrr�
test_func_def�szEndPositionTests.test_func_defcCsNd}|�|�}|�||jd�|�||jdjd�|�||jdjd�dS)Nzfunc(x, y=2, **kw)r�r�2r��kw)r�r�r�r�r0�r-r�r�rrrr��s

zEndPositionTests.test_callcCs0d}|�|�}|�||jd�|�|dd�dS)Nzx[0]()zx[0]r�r)r�r�r�r�r�rrr�test_call_noargs�s
z!EndPositionTests.test_call_noargscCsVtd���}t�|�jd}|�|dd�|�||jdd�|�||jdd�dS)Nz?
            class C(A, B):
                x: int = 0
        rr3�r��Bz
x: int = 0)rrjr(r\r_r�r�r;�r-r��cdefrrr�test_class_def�s
zEndPositionTests.test_class_defcCs.d}t�|�jd}|�||jdjd�dS)Nz$class S(metaclass=abc.ABCMeta): passrzabc.ABCMeta)r(r\r_r�r�r0r�rrr�
test_class_kwszEndPositionTests.test_class_kwcCs>td���}t�|�jd}|�|dd�|�|jdd�dS)Nzh
            x = """Some multi-line text.

            It goes on starting from same indent."""
        rr��(�rrjr(r\r_r�r0�r-r�r�rrr�test_multi_line_strsz$EndPositionTests.test_multi_line_strcCs>td���}t�|�jd}|�|dd�|�|jdd�dS)NzB
            x = "first part" \
            "second part"
        rr3rr�r�rrr�test_continued_strsz#EndPositionTests.test_continued_strcCstd���}t�|�}|jd}|jd}|jd}|jd}|jd}|�|dd�|�|dd	�|�|d	d
�|�|dd�|�|dd�|�||jd
�|�||jdd�|�||jdjd�|�||j	d�|�||jdd�|�||j
djd�dS)Na
            while True:
                pass

            if one():
                x = None
            elif other():
                y = None
            else:
                z = None

            for x, y in stuff:
                assert True

            try:
                raise RuntimeError
            except TypeError as e:
                pass

            pass
        rr�r3r�r�r�r�r���r�zx = Nonezother()�x, yzraise RuntimeErrorr9)rrjr(r\r_r�r�r�rr�Zhandlersrv)r-r�rkZ
while_loopZif_stmtZfor_loopZtry_stmtZ	pass_stmtrrr�test_suitess$





zEndPositionTests.test_suitescCs,d}|�|�}|jdj}|�||d�dS)Nzx = f"abc {x + y} abc"r�zx + y)r�rr0r��r-r�Zfstrr�rrr�test_fstringDs
zEndPositionTests.test_fstringcCsTtd���}|�|�}|jdj}|�|dd�|�||jd�|�||jd�dS)Nz�
            f"""Some multi-line text.
            {
            arg_one
            +
            arg_two
            }
            It goes on..."""
        r�r�r�Zarg_oneZarg_two)	rrjr�rr0r�r�r�r�r�rrr�test_fstring_multi_lineJs	
z(EndPositionTests.test_fstring_multi_linecCs.td���}t�|�jd}|�|dd�dS)NzT
            from x.y.z import (
                a, b, c as c
            )
        rr�r�)rrjr(r\r_r�)r-r�rYrrr�test_import_from_multi_lineZsz,EndPositionTests.test_import_from_multi_linecCs�d}d}td���}t|j|||f�\}}}|�||jd�|�||jjjd�|�||jjd�|�||jjd�|�||jj	djd	�|�||jj	d
jd�|�
|dd�dS)
Nz
f()[1, 2] [0]zx[ a.b: c.d]zN
            x[ a.b: f () ,
               g () : c.d
              ]
        z	f()[1, 2]z1, 2r#zc.dr�f ()r��g ()r�)rrj�mapr�r�r0r`rbraZdimsr�)r-�s1�s2�smZi1Zi2rfrrr�test_slicescszEndPositionTests.test_slicescCsZtd���}|�|�}|�|dd�|�||jd�|�||jd�|�||jjd�dS)NzF
            (1 * 2 + (3 ) +
                 4
            )
        r3r�4z1 * 2 + (3 )�3)rrjr�r�r�r�r�)r-r�r�rrr�
test_binopts
zEndPositionTests.test_binopcCsDtd���}t�|�jdj}|�|dd�|�||jdd�dS)Nz{
            if (one_condition and
                    (other_condition or yet_another_one)):
                pass
        rr3�,r�z"other_condition or yet_another_one)	rrjr(r\r_r�r�r�r)r-r�Zboprrrrb�s�zEndPositionTests.test_boolopc	Cspd}d}d}td���}t|j||||f�\}}}}|�||d�|�||d�|�||d�|�|dd	�dS)
Nzx = () ;z	x = 1 , ;zx = (1 , 2 ) ;z?
            x = (
                a, b,
            )
        r%z1 ,z(1 , 2 )r�r�)rrjr�r�r�r�)	r-r�r�Zs3r��t1�t2Zt3Ztmrrr�test_tuples�szEndPositionTests.test_tuplescCs4d}|�|�}|�|||�|�||jdd�dS)Nz
func(x. y .z)rzx. y .z)r�r�r{r�rrr�test_attribute_spaces�s
z&EndPositionTests.test_attribute_spacescCsvd}t�|�jdj}|�t|�jd�|�||d�d|}t�|�jdjj}|�t|�jd�|�||d�dS)Nz( ( ( a + b ) ) )rr�r �await )r(r\r_r0r4rvrr�)r-r�r$r�rrr�test_redundant_parenthesis�sz+EndPositionTests.test_redundant_parenthesisc
Cs�d}|D]�\}}|�|��tt�|�jdj}|�t|�j|�|�|||�d|}t�|�jdjj}|�t|�j|�|�|||�W5QRXqdS)N))z( ( ( a ) ) ) ( )r�)z( ( ( a ) ) ) ( b )r�)z( ( ( a ) ) ) [ b ]r�)z( ( ( a ) ) ) . br�rr�)	rTr(r\r_r0r4rvrr�)r-r�r�rr$r�rrr�(test_trailers_with_redundant_parenthesis�sz9EndPositionTests.test_trailers_with_redundant_parenthesiscCs�d}d}|�|�}|�|�}|�||jdd�|�||jdd�|�||jdd�|�||jdd	�|�||jdd
�dS)Nz[{}, {1, }, {1, 2,} ]z{a: b, f (): g () ,}rr!r�z{1, }r3z{1, 2,}r�r�)r�r�Zeltsrr)r-r�r�Zc1Zc2rrr�
test_displays�s

zEndPositionTests.test_displayscCs�td���}|�|�}|�|dd�|�||jdjd�|�||jjdjd�|�||jjdjdd�|�||jjdj	d�dS)	Nza
            x = [{x for x, y in stuff
                  if cond.x} for stuff in things]
        r3�%rZthingsZstuffzcond.xr�)
rrjr�r�r�Z
generators�iterZeltZifsr�)r-r�Zcmprrr�test_comprehensions�s
z$EndPositionTests.test_comprehensionscCsLtd���}t�|�jd}|�||jdjd�|�||jdjd�dS)NzT
            async def f():
                yield x
                await y
        rzyield xr�zawait y)rrjr(r\r_r�r0r�rrr�test_yield_await�sz!EndPositionTests.test_yield_awaitcCs<td���}td���}|�|�}|�t�||j�|�dS)NzD
            x = (
                a, b,
            ) + ()
        z;
            (
                a, b,
            )
        )rrjr�r4r(r�r�)r-�s_origZs_tupler�rrr�test_source_segment_multi�s
z*EndPositionTests.test_source_segment_multicCsBtd���}d}t�|�jd}|�tj||jddd�|�dS)Nuf
            class C:
                def fun(self) -> None:
                    "ЖЖЖЖЖ"
        u/    def fun(self) -> None:
        "ЖЖЖЖЖ"rT�Zpadded�rrjr(r\r_r4r�)r-r�s_methodr�rrr�test_source_segment_padded�s�z+EndPositionTests.test_source_segment_paddedcCsdd}t�|�j\}}}}}|�||d�|�||d�|�||d�|�||d�|�||d�dS)Nz!v = 1
w = 1
x = 1

y = 1
z = 1
rzw = 1r�zy = 1zz = 1)r(r\r_r�)r-r�r$r�r;r3r�rrr�test_source_segment_endings�sz,EndPositionTests.test_source_segment_endingscCsBtd���}d}t�|�jd}|�tj||jddd�|�dS)Nzb
            class C:
              	  def fun(self) -> None:
              	      pass
        z+  	  def fun(self) -> None:
  	      passrTrr)r-r�r	r�rrr�test_source_segment_tabs�sz)EndPositionTests.test_source_segment_tabsN)!rr>r?r�r�r�r�rhr�r�r�r�r�r�r�r�r�r�r�r�r�rbr�r�r�r�rrrrr
rrrrrrr��s<

	,	

	r�c@seZdZdd�ZdS)�NodeVisitorTestscs�G�fdd�dtj�}t�td��}|�}g�tjdd��}t�ddt�|�|�W5QRX|�	�dd	d
ddd
ddg�|�	dd�|D�ddddddddg�dS)NcsHeZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Z�fd	d
�ZdS)z9NodeVisitorTests.test_old_constant_nodes.<locals>.Visitorcs��|jd|jf�dS)Nr�)rr
r�r���logrr�	visit_NumszCNodeVisitorTests.test_old_constant_nodes.<locals>.Visitor.visit_Numcs��|jd|jf�dS)Nr��rr
r�r�rrr�	visit_StrszCNodeVisitorTests.test_old_constant_nodes.<locals>.Visitor.visit_Strcs��|jd|jf�dS)Nr�rr�rrr�visit_BytesszENodeVisitorTests.test_old_constant_nodes.<locals>.Visitor.visit_Bytescs��|jd|jf�dS)Nr�)rr
r0r�rrr�visit_NameConstantszLNodeVisitorTests.test_old_constant_nodes.<locals>.Visitor.visit_NameConstantcs��|jddf�dS)Nr�.)rr
r�rrr�visit_EllipsisszHNodeVisitorTests.test_old_constant_nodes.<locals>.Visitor.visit_EllipsisN)rr>r?rrrrrrrrr�Visitors
rz�            i = 42
            f = 4.25
            c = 4.25j
            s = 'string'
            b = b'bytes'
            t = True
            n = None
            e = ...
            T)�record�alwaysr
)r�r�r1)r3r�r�)r�r�r�)r�r�r�)r�r�r�)rr�T)r�r�N)r�r�.cSsg|]}t|j��qSr)r
�message)rr�rrrr	2sz<NodeVisitorTests.test_old_constant_nodes.<locals>.<listcomp>z+visit_Num is deprecated; add visit_Constantz+visit_Str is deprecated; add visit_Constantz-visit_Bytes is deprecated; add visit_Constantz4visit_NameConstant is deprecated; add visit_Constantz0visit_Ellipsis is deprecated; add visit_Constant)
r(ZNodeVisitorr\r�warnings�catch_warnings�filterwarnings�PendingDeprecationWarningZvisitr4)r-rrkZvisitorZwlogrrr�test_old_constant_nodes
s6
�
�z(NodeVisitorTests.test_old_constant_nodesN)rr>r?rrrrrr
sr
cCs�tdkrdStjdd�dgkr�tdftdftdffD]F\}}t|d�|D]$}t�|d|�}td	t	|�f�qNtd
�q6td�t
�t��dS)N�__main__r�z-grFrGrHz_results = [rKz%r,�]zmain())
r�sys�argvrMrOrQ�printr(r\r�
SystemExit�unittest�main)Z
statementsrLZ	statementr]rrrr&>s�
r&r�)r��r�r�r�r'NN)r�r')r�r'zmodule docstringNr7r'rr�)r8�r�r)r�r))r�r)zfunction docstringN)r4�r�rrANN)r8�r�r�)r��r�r�rN)r8�r�r�)r4�r�r�r{NN)r8�r�r�)r4r,r�NN)r8�r�r�)r4r)r�NN)r4r/rNN)r4�r��rNN)r4�r��rNN)r4�r��#r{NN)r4)r��)rNN)r�)r��+r1N)r4)r��1r�NN)r��r�r
r�N)r��r��NNr��r���r�r)r��)r��r��:)r�rAzdoc for f()Nr:�C)r8r,)r�r))r�r)zdocstring for class CN)rqr,�objectr?)ZReturnr,)r��r�r�r�Nr@)rq�r�r�r$)ZDelrC�rqr'r$�r0)r�rFr�Nr�)rqr'rArH)rq�r�r3r�rHrH)rqr*rr?�rq�r�r�rArH)rq�r�r�r�rH)rqr,rr?)rEr'rG�r�)r��r�r�r�Nrp)rqrFr$rH)rqr)r$r?)r8r:rI)rqr*r$r?rK)rqrLr$r?)r8rN)rqrLrAr?)r8�r3r3)r�r)rq)r�r�r�r?)r8)r�r3)r8)rr3rM)rN)rqrNr;r?)rqr+r3rH)r8�r�r)rN)rqrPr�r?)rq�r���qrH)r8�r��r�r�r*)rqr*r�r?)r�r;r�NrRrS)rqr�r�r?)rUr')rqr.r$r?NrW)r&r!Nrir!)r&r$Nr[)r�r'�r�r'r�N)r8r')ZBreakr:)ZContinuer:rF)rqrFrArH)rqr*r�rH)rqr:rr?)rqrNrArH)rqr.r�rH)rqrPrr?)r8r;r�ry)r3r�)rq)r�r��Aar?)rq)r�r��Bbr?rr�r�r�)rqrYrWrH)rq)r�r�rXrH)rq)r�r�ZCcr?r{�rqrKrAr?)rqrNr�r?)rqr:r�rH)rqr;r;r?)rqr1r�rH)rq�r��rGr?)rq)r�� rqr?r:)rqr:r$rH)rqrPr�rH)rqrQr;r?rw)rqrKrPr?)rqr.rjrH)rqr-r;r?)rqr0rqr?r.)rqr)r�rH)rqr/r;r?ZAsyncFunctionDef)r��r3r�)r�r^zasync functionN�r�r�ZAwaitr�)rqr�Z	somethingr?ZAsyncForr^)rq)r3r
rrH)rq)r3r<rXr?)r��r3r�)r�r`r�N)r�r�)r�r�r3NZ	AsyncWith)rN)rq)r3r�rAr?)rq)r3r�r�rH)r��r3�)r�rar�N)r�r+r3NrL)r�r*r3N)r�r-r�Nrnr�rKrI)r�rLr�N)r�r+r�Nru)rqrOrXr?)rq)r3r�r�rH)rqr`rr?r�)r�r)r8)r�r)rqrKZdeco1r?)rqr^Zdeco2r?)rqr_Zdeco3r?)r�r�r�N)r8)r�r�)r3r)r8)r3r)rqrKZdecor?rN)rqr*rAr?)rqr-rArH)rqr0r�r?)r�rK)r�rKrZr�r?rr?)r�r')Z	NamedExprrKrJ)r�r*r�N)r4r-rNN)r4rErNN)r4rQrNN)r8r1)r4rQrNN)r4rTrNN)r8)r��)r4�r��r�NN)r8r5)r�r,r�N)r4r/r�NN)r4)r�r�rNN)r�r;r3N)r�rTr�N)r4r1rNN)r�r=r�N)r8r3)r8rd)r4)r��r�NN)r8)r��&)r4r[r�NN)r8)r��$r/)r�r')r�r'rVrM�r�rIr3N)r�r(r�r`)ra�rqr'rAr?)rqr*r�r?)r�)r�r'rjrM�rqrFr�r?)r�)rcr')rd)rqrFr$r?rg)r�r.NN)r�rIr�N)r�rFr3N)r�rKNN)r�)r3rr�N)r�)r�r�r3N)rqr-rr?)rqr0rr?)rqrIrAr?rk)rqr:rArH)rqrPr�rH)rqrQrr?)rqr/r�rH)rq)r�rbrr?r�rV)ZLt�r�r,r�N)rqr'rr?)r�r+)rqr:rr?r?)r>rrl)r>N)rqrErr?)r�rFrN)r�r.r�N)rqr,rArH)rqrPr�r?)r�)r�r'r�N)r�)r�r'r�N)r��r�r'rjr�r?)r�)r�r'rj)r�)rqrIr�r?)rqrFrr?Nr?)r�)rqr'r$r?)r�rKr�N)r�rLr3N)r�rNr�Nri)r�rFr�N)r�r')r�r'rmrr?rr?)r�r,)r�r,)rqr,rAr?r�r?)r�)r�r-r�N)r�r/r3NNr?)r(r�r�r!r%rrB�textwraprr�rrrMrOrQZTestCaser&r�r+r�r�r
r&rNrPrRrrrr�<module>s���
��K.N2

,,.0,,R,"""
$&&


&&&<42&0HJB4<TVVD^4.<@B2DDBFD�F�$$"BBB@@@@@@&(42�%