o
    DDi                     @   st   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ G dd	 d	eZG d
d deZdS )    )AnyN)parse_statement)CSTNodeTest)ensure_type)	CodeRange)data_providerc                   @   s  e Zd Zeeeedfddeeedeedfdedddejejedej	e
d	e
d	d
deedfe
d	ddedddfdeddfddZedd dddd dddd dddd ddfdeddfddZdS ) NonlocalConstructionTesta
nonlocal anodecodebnonlocal a, b)   r   )r      )r   r   expected_position  whitespace_beforewhitespace_aftercommawhitespace_after_nonlocalnonlocal  a  ,  b)r      kwargsreturnNc                 K      | j di | d S N validate_nodeselfr   r!   r!   Z/var/www/Datamplify/venv/lib/python3.10/site-packages/libcst/_nodes/tests/test_nonlocal.py
test_valid   s   $z#NonlocalConstructionTest.test_validc                   C   s
   t dS r    )cstNonlocalr!   r!   r!   r&   <lambda>;   s   
 z!NonlocalConstructionTest.<lambda>z4A Nonlocal statement must have at least one NameItem)get_nodeexpected_rec                   C   s"   t jt t dft ddS )Nr	    r   )r(   r)   NameItemNameSimpleWhitespacer!   r!   r!   r&   r*   @   s    z5Must have at least one space after 'nonlocal' keywordc                   C   s    t t jt dt  dfS )Nr	   r   )r(   r)   r.   r/   Commar!   r!   r!   r&   r*   H   s    z<The last NameItem in a Nonlocal cannot have a trailing commac                	   C   s*   t t t jdt  ft  fdfS )Nr	   )lparrpar)r(   r)   r.   r/   	LeftParen
RightParenr!   r!   r!   r&   r*   O   s    z+Cannot have parens around names in NameItemc                 K   r   r    )assert_invalidr$   r!   r!   r&   test_invalid7   s   &z%NonlocalConstructionTest.test_invalid)__name__
__module____qualname__r   r(   r)   r.   r/   r   r1   r0   r   r'   r7   r!   r!   r!   r&   r      sZ    	
#		%r   c                   @   s   e Zd Zeeeedfddeejedeje	dddeedfddejejedeje	d	e	d	d
deedfe	d	dddfde
ddfddZdS )NonlocalParsingTestr	   r
   r    )r   r   r   r   r   r   r   r   r   r   Nc                 K   s   | j dddd i| d S )Nparserc                 S   s   t t| tjjd S )Nr   )r   r   r(   SimpleStatementLinebody)r   r!   r!   r&   r*      s
    
z0NonlocalParsingTest.test_valid.<locals>.<lambda>r!   r"   r$   r!   r!   r&   r'   a   s
   (
zNonlocalParsingTest.test_valid)r8   r9   r:   r   r(   r)   r.   r/   r1   r0   r   r'   r!   r!   r!   r&   r;   `   s@    	
'r;   )typingr   libcstr(   r   libcst._nodes.tests.baser   libcst.helpersr   libcst.metadatar   libcst.testing.utilsr   r   r;   r!   r!   r!   r&   <module>   s   P