a
    Ø
þd˜  ã                   @   s¤   d Z ddl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 ddlmZ G d	d
„ d
ejƒZG dd„ dejƒZdd„ Zdd„ Zedkr e ¡  dS )zTests for yapf.logical_line.é    N)Úpytree)Útoken)Úsplit_penalty)Úformat_token)Úlogical_line)Úyapf_test_helperc                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚLogicalLineBasicTestc                 C   sV   t tjddftjddfgƒ}t d|¡}|  d|j¡ |  ddgdd„ |jD ƒ¡ d S )NÚ.ÚDOTú|ÚVBARé   c                 S   s   g | ]
}|j ‘qS © ©Úname©Ú.0Útokr   r   úd/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/yapftests/logical_line_test.pyÚ
<listcomp>$   ó    z9LogicalLineBasicTest.testConstruction.<locals>.<listcomp>)	Ú_MakeFormatTokenListr   r
   r   r   ÚLogicalLineÚassertEqualÚdepthÚtokens©ÚselfÚtoksÚlliner   r   r   ÚtestConstruction   s    
ÿz%LogicalLineBasicTest.testConstructionc                 C   sd   t tjddftjddftjddfgƒ}t d|¡}|  d|j¡ |  d|j	j
¡ |  d|jj
¡ d S )Nr	   r
   ú(ÚLPARr   r   r   )r   r   r
   r"   r   r   r   r   r   Úfirstr   Úlastr   r   r   r   ÚtestFirstLast&   s    

þz"LogicalLineBasicTest.testFirstLastc                 C   sF   t tjddftjddftjddfgƒ}t d|¡}|  d| ¡ ¡ d S )	Nr	   r
   r!   r"   r   r   é   z	    . ( |)	r   r   r
   r"   r   r   r   r   ZAsCoder   r   r   r   Ú
testAsCode/   s    

þzLogicalLineBasicTest.testAsCodec                 C   sR   t  d¡}| ttjddƒ¡ | ttjddƒ¡ |  ddgdd„ |jD ƒ¡ d S )Nr   r!   r"   ú)ÚRPARc                 S   s   g | ]
}|j ‘qS r   r   r   r   r   r   r   :   r   z8LogicalLineBasicTest.testAppendToken.<locals>.<listcomp>)	r   r   ZAppendTokenÚ_MakeFormatTokenLeafr   r"   r)   r   r   )r   r   r   r   r   ÚtestAppendToken6   s    
z$LogicalLineBasicTest.testAppendTokenN)Ú__name__Ú
__module__Ú__qualname__r    r%   r'   r+   r   r   r   r   r      s   	r   c                   @   s   e Zd Zdd„ ZdS )Ú$LogicalLineFormattingInformationTestc                 C   s„   t  d¡}t |¡}|d jd }|  |j¡ |  |j¡ |  |j	t	j
¡ |d jd }|  |j¡ |  |j¡ |  |j	t	j
¡ d S )Nz-
        def f(a, b):
          pass
        r   é   r&   )ÚtextwrapÚdedentr   ZParseAndUnwrapr   ZassertFalseZcan_break_beforeZmust_break_beforer   r   ZUNBREAKABLE)r   ÚcodeZllinesÚfZlparenr   r   r   ÚtestFuncDef?   s    

z0LogicalLineFormattingInformationTest.testFuncDefN)r,   r-   r.   r5   r   r   r   r   r/   =   s   r/   c                 C   s   t  t | |¡|¡S )N)r   ZFormatTokenr   ZLeaf)Ú
token_typeÚtoken_valuer   r   r   r   r*   Q   s    r*   c                 C   s   dd„ | D ƒS )Nc                 S   s   g | ]\}}}t |||ƒ‘qS r   )r*   )r   r6   r7   Z
token_namer   r   r   r   V   s   ÿz(_MakeFormatTokenList.<locals>.<listcomp>r   )Ztoken_type_valuesr   r   r   r   U   s    þr   Ú__main__)Ú__doc__r1   ZunittestZyapf_third_party._ylib2to3r   Z yapf_third_party._ylib2to3.pgen2r   Zyapf.pytreer   Zyapf.yapflibr   r   Z	yapftestsr   ZTestCaser   ZYAPFTestr/   r*   r   r,   Úmainr   r   r   r   Ú<module>   s    