o
    DDiN                     @   sd   d dl Z d dlmZ d dlZd dlmZ d dlmZm	Z	m
Z
mZmZ d dlmZ G dd deZdS )    N)Union)leaveMatchDecoratorMismatchMatcherDecoratableTransformerMatcherDecoratableVisitorvisit)UnitTestc                   @   s  e Zd ZdOddZdOddZdOddZdOd	d
ZdOddZdOddZdOddZ	dOddZ
dOddZdOddZdOddZdOddZdOddZdOddZdOdd ZdOd!d"ZdOd#d$ZdOd%d&ZdOd'd(ZdOd)d*ZdOd+d,ZdOd-d.ZdOd/d0ZdOd1d2ZdOd3d4ZdOd5d6ZdOd7d8ZdOd9d:ZdOd;d<ZdOd=d>Z dOd?d@Z!dOdAdBZ"dOdCdDZ#dOdEdFZ$dOdGdHZ%dOdIdJZ&dOdKdLZ'dOdMdNZ(dS )P%MatchersVisitLeaveDecoratorTypingTestreturnNc                 C      G dd dt }|  d S )Nc                   @   sL   e Zd Zee dejddfddZee dejddfddZ	dS )	zVMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_simple.<locals>.TestVisitornoder
   Nc                 S      d S N selfr   r   r   \/var/www/Datamplify/venv/lib/python3.10/site-packages/libcst/matchers/tests/test_visitors.py_string_visit      zdMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_simple.<locals>.TestVisitor._string_visitoriginal_nodec                 S   r   r   r   r   r   r   r   r   _string_leave   r   zdMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_simple.<locals>.TestVisitor._string_leave
__name__
__module____qualname__r   mSimpleStringcstr   r   r   r   r   r   r   TestVisitor   s
    

r   r   r   r   r   r   r   test_valid_collector_simple      

zAMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_simplec                 C   r   )Nc                   @   sT   e Zd Zee dejddfddZee dejdejdejfdd	Z	dS )
zXMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_simple.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   %   r   zfMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_simple.<locals>.TestVisitor._string_visitr   updated_nodec                 S      |S r   r   r   r   r$   r   r   r   r   )      zfMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_simple.<locals>.TestVisitor._string_leaver   r   r   r   r   r   $   s    

r   r   r!   r   r   r   test_valid_transformer_simple#   s   
zCMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_simplec                 C   r   )Nc                   @   4   e Zd Zee dejdejdejfddZdS )z\MatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_base_class.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r   4   r'   zjMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_base_class.<locals>.TestVisitor._string_leaveN)	r   r   r   r   r   r   r   BaseExpressionr   r   r   r   r   r   3       
r   r(   r!   r   r   r   !test_valid_transformer_base_class2      
zGMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_base_classc                 C   r   )Nc                   @   >   e Zd Zee e B deejejf ddfddZ	dS )z[MatchersVisitLeaveDecoratorTypingTest.test_valid_collector_visit_union.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   ?   r   ziMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_visit_union.<locals>.TestVisitor._string_visit
r   r   r   r   r   r   Namer   r   r   r   r   r   r   r   >       $r   r    r!   r   r   r    test_valid_collector_visit_union=      
zFMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_visit_unionc                 C   r   )Nc                   @   r/   )z]MatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_visit_union.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   H   r   zkMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_visit_union.<locals>.TestVisitor._string_visitr0   r   r   r   r   r   G   r2   r   r(   r!   r   r   r   "test_valid_transformer_visit_unionF   r4   zHMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_visit_unionc                 C   r   )Nc                   @   4   e Zd Zee e B dejddfddZ	dS )z`MatchersVisitLeaveDecoratorTypingTest.test_valid_collector_visit_superclass.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   Q   r   znMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_visit_superclass.<locals>.TestVisitor._string_visit
r   r   r   r   r   r   r1   r   r+   r   r   r   r   r   r   P       r   r    r!   r   r   r   %test_valid_collector_visit_superclassO   r4   zKMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_visit_superclassc                 C   r   )Nc                   @   r6   )zbMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_visit_superclass.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   Z   r   zpMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_visit_superclass.<locals>.TestVisitor._string_visitr7   r   r   r   r   r   Y   r8   r   r(   r!   r   r   r   'test_valid_transformer_visit_superclassX   r4   zMMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_visit_superclassc                 C   r   )Nc                   @   r/   )z[MatchersVisitLeaveDecoratorTypingTest.test_valid_collector_leave_union.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   c   r   ziMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_leave_union.<locals>.TestVisitor._string_leave
r   r   r   r   r   r   r1   r   r   r   r   r   r   r   r   b   r2   r   r    r!   r   r   r    test_valid_collector_leave_uniona   r4   zFMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_leave_unionc                 C   r   )Nc                	   @   sZ   e Zd Zee e B deejejf deejejf deejejf fddZ	dS )z]MatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_union.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r   l      zkMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_union.<locals>.TestVisitor._string_leaveNr;   r   r   r   r   r   k       r   r(   r!   r   r   r   "test_valid_transformer_leave_unionj   r#   zHMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_unionc                 C   r   )Nc                   @   r6   )z`MatchersVisitLeaveDecoratorTypingTest.test_valid_collector_leave_superclass.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   y   r   znMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_leave_superclass.<locals>.TestVisitor._string_leave
r   r   r   r   r   r   r1   r   r+   r   r   r   r   r   r   x   r8   r   r    r!   r   r   r   %test_valid_collector_leave_superclassw   r4   zKMatchersVisitLeaveDecoratorTypingTest.test_valid_collector_leave_superclassc                 C   r   )Nc                   @   <   e Zd Zee e B dejdejdejfddZ	dS )zbMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_superclass.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r      r=   zpMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_superclass.<locals>.TestVisitor._string_leaveNr@   r   r   r   r   r          r   r(   r!   r   r   r   'test_valid_transformer_leave_superclass   r#   zMMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_superclassc                 C   r   )Nc                	   @   >   e Zd Zee dejdejdeejejf fddZ	dS )zdMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_return_maybe.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   _assign_equal_leave   r'   zxMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_return_maybe.<locals>.TestVisitor._assign_equal_leaveN)
r   r   r   r   r   AssignEqualr   r   MaybeSentinelrF   r   r   r   r   r          
r   r(   r!   r   r   r   )test_valid_transformer_leave_return_maybe   r.   zOMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_return_maybec                 C   r   )Nc                	   @   rE   )zeMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_return_remove.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r      r'   zsMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_return_remove.<locals>.TestVisitor._string_visitN)
r   r   r   r   r   AssignTargetr   r   RemovalSentinelr   r   r   r   r   r      rI   r   r(   r!   r   r   r   *test_valid_transformer_leave_return_remove   r.   zPMatchersVisitLeaveDecoratorTypingTest.test_valid_transformer_leave_return_removec                 C   H   G dd dt }| td |  W d    d S 1 sw   Y  d S )Nc                   @   ,   e Zd Zee dejdefddZdS )z^MatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_return.<locals>.TestVisitorr   r
   c                 S      dS NFr   r   r   r   r   r      r   zlMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_return.<locals>.TestVisitor._string_visitN	r   r   r   r   r   r   r   boolr   r   r   r   r   r          
r   8@visit should only decorate functions that do not returnr   assertRaisesRegexr   r!   r   r   r   #test_invalid_collector_visit_return      "zIMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_returnc                 C   rN   )Nc                   @   rO   )z`MatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_return.<locals>.TestVisitorr   r
   c                 S   rP   rQ   r   r   r   r   r   r      r   znMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_return.<locals>.TestVisitor._string_visitNrR   r   r   r   r   r      rT   r   rU   r   rW   r   r!   r   r   r   %test_invalid_transformer_visit_return   rY   zKMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_returnc                 C   rN   )Nc                   @   2   e Zd Zee dejdejddfddZdS )zdMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_num_params.<locals>.TestVisitorr   r$   r
   Nc                 S   r   r   r   r&   r   r   r   r      r'   zrMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_num_params.<locals>.TestVisitor._string_visitr   r   r   r   r   r   r   r   r   r   r   r   r          
r   7@visit should decorate functions which take 1 parameterrZ   r!   r   r   r   )test_invalid_transformer_visit_num_params      "zOMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_num_paramsc                 C   rN   )Nc                   @   r\   )zbMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_num_params.<locals>.TestVisitorr   r$   r
   Nc                 S   r   r   r   r&   r   r   r   r      r'   zpMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_num_params.<locals>.TestVisitor._string_visitr]   r   r   r   r   r      r^   r   r_   rV   r!   r   r   r   'test_invalid_collector_visit_num_params   ra   zMMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_num_paramsc                 C   rN   )Nc                   @   s.   e Zd Zee dejdejfddZdS )zdMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_num_params.<locals>.TestVisitorr   r
   c                 S   s   |S r   r   r   r   r   r   r      r'   zrMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_num_params.<locals>.TestVisitor._string_leaveNr   r   r   r   r   r   r   r   r   r   r   r   r      s    
r   z8@leave should decorate functions which take 2 parametersrZ   r!   r   r   r   )test_invalid_transformer_leave_num_params   ra   zOMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_num_paramsc                 C   rN   )Nc                   @   r\   )zbMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_num_params.<locals>.TestVisitorr   r$   r
   Nc                 S   r   r   r   r&   r   r   r   r      r'   zpMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_num_params.<locals>.TestVisitor._string_leaverc   r   r   r   r   r      r^   r   z7@leave should decorate functions which take 1 parameterrV   r!   r   r   r   'test_invalid_collector_leave_num_params   ra   zMMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_num_paramsc                 C   rN   )Nc                   @   rO   )z^MatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_return.<locals>.TestVisitorr   r
   c                 S   rP   rQ   r   r   r   r   r   r      r   zlMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_return.<locals>.TestVisitor._string_leaveN)	r   r   r   r   r   r   r   rS   r   r   r   r   r   r      rT   r   z8@leave should only decorate functions that do not returnrV   r!   r   r   r   #test_invalid_collector_leave_return   rY   zIMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_returnc                 C   rN   )Nc                   @   r*   )zsMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_superclass.<locals>.TestVisitorr   r$   r
   c                 S   
   t dS )N )r   SimpleWhitespacer&   r   r   r   r     s   
zMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_superclass.<locals>.TestVisitor._string_visitN)	r   r   r   r   r   r   r   BaseParenthesizableWhitespacer   r   r   r   r   r     r,   r   zN@leave decorated function cannot return the type BaseParenthesizableWhitespacerZ   r!   r   r   r   8test_invalid_transformer_leave_return_invalid_superclass  ra   z^MatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_superclassc                 C   rN   )Nc                   @   r*   )zkMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_wrong_type.<locals>.TestVisitorr   r$   r
   c                 S   s   t  S r   )r   Passr&   r   r   r   r     s   zyMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_wrong_type.<locals>.TestVisitor._string_visitN)	r   r   r   r   r   r   r   rl   r   r   r   r   r   r     r,   r   5@leave decorated function cannot return the type PassrZ   r!   r   r   r   0test_invalid_transformer_leave_return_wrong_type  ra   zVMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_wrong_typec                 C   rN   )Nc                	   @   rE   )znMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_maybe.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r   &  r'   z|MatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_maybe.<locals>.TestVisitor._string_visitN)
r   r   r   r   r   r   r   r   rH   r   r   r   r   r   r   %  rI   r   z>@leave decorated function cannot return the type MaybeSentinelrZ   r!   r   r   r   3test_invalid_transformer_leave_return_invalid_maybe$  ra   zYMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_maybec                 C   rN   )Nc                	   @   rE   )zoMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_remove.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r   5  r'   z}MatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_remove.<locals>.TestVisitor._string_visitN)
r   r   r   r   r   r   r   r   rL   r   r   r   r   r   r   4  rI   r   z@@leave decorated function cannot return the type RemovalSentinelrZ   r!   r   r   r   4test_invalid_transformer_leave_return_invalid_remove3  ra   zZMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_removec                 C   rN   )Nc                	   @   sZ   e Zd Zee e B deejejf deejejf deejej	f fddZ
dS )znMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_union.<locals>.TestVisitorr   r$   r
   c                 S   rg   )Nz"")r   r   r&   r   r   r   r   D  s   
z|MatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_union.<locals>.TestVisitor._string_leaveN)r   r   r   r   r   r   r1   r   r   rl   r   r   r   r   r   r   C  r>   r   rm   rZ   r!   r   r   r   3test_invalid_transformer_leave_return_invalid_unionB     
"zYMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_return_invalid_unionc                 C   rN   )Nc                   @   4   e Zd Zee e B dejddfddZdS )z]MatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_union.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   U  r   zkMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_union.<locals>.TestVisitor._string_visit	r   r   r   r   r   r   r1   r   r   r   r   r   r   r   T  r8   r   h@visit can be called with Name but the decorated function parameter annotations do not include this typerV   r!   r   r   r   "test_invalid_collector_visit_unionS  rY   zHMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_unionc                 C   rN   )Nc                   @   rs   )z_MatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_union.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   b  r   zmMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_union.<locals>.TestVisitor._string_visitrt   r   r   r   r   r   a  r8   r   ru   rZ   r!   r   r   r   $test_invalid_transformer_visit_union`  rY   zJMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_unionc                 C   rN   )Nc                   @   r6   )zbMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_superclass.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   o  r   zpMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_superclass.<locals>.TestVisitor._string_visit
r   r   r   r   r   r   rl   r   r+   r   r   r   r   r   r   n  r8   r   h@visit can be called with Pass but the decorated function parameter annotations do not include this typerV   r!   r   r   r   'test_invalid_collector_visit_superclassm  rY   zMMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_visit_superclassc                 C   rN   )Nc                   @   r6   )zdMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_superclass.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r   |  r   zrMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_superclass.<locals>.TestVisitor._string_visitrx   r   r   r   r   r   {  r8   r   ry   rZ   r!   r   r   r   )test_invalid_transformer_visit_superclassz  rY   zOMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_visit_superclassc                 C   rN   )Nc                   @   rs   )z]MatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_union.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r     r   zkMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_union.<locals>.TestVisitor._string_leave)	r   r   r   r   r   r   r1   r   r   r   r   r   r   r     r8   r   h@leave can be called with Name but the decorated function parameter annotations do not include this typerV   r!   r   r   r   "test_invalid_collector_leave_union  rY   zHMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_unionc                 C   rN   )Nc                   @   s<   e Zd Zee e B dejdejdejfddZ	dS )z_MatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_union.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r     r'   zmMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_union.<locals>.TestVisitor._string_leaveNr@   r   r   r   r   r     s    r   r|   rZ   r!   r   r   r   $test_invalid_transformer_leave_union  ra   zJMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_unionc                 C   rN   )Nc                   @   r6   )zbMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_superclass.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r     r   zpMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_superclass.<locals>.TestVisitor._string_leave
r   r   r   r   r   r   rl   r   r+   r   r   r   r   r   r     r8   r   h@leave can be called with Pass but the decorated function parameter annotations do not include this typerV   r!   r   r   r   'test_invalid_collector_leave_superclass  rY   zMMatchersVisitLeaveDecoratorTypingTest.test_invalid_collector_leave_superclassc                 C   rN   )Nc                   @   rB   )zdMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_superclass.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r     r=   zrMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_superclass.<locals>.TestVisitor._string_leaveNr   r   r   r   r   r     rC   r   r   rZ   r!   r   r   r   )test_invalid_transformer_leave_superclass  rr   zOMatchersVisitLeaveDecoratorTypingTest.test_invalid_transformer_leave_superclassc                 C   rN   )Nc                   @   ,   e Zd Zee dejddfddZdS )z]MatchersVisitLeaveDecoratorTypingTest.test_bad_visit_collecter_decorator.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   visit_SimpleString  r   zpMatchersVisitLeaveDecoratorTypingTest.test_bad_visit_collecter_decorator.<locals>.TestVisitor.visit_SimpleStringr   r   r   r   r   r   r   r   r   r   r   r   r     rT   r   M@visit should not decorate functions that are concrete visit or leave methodsrV   r!   r   r   r   "test_bad_visit_collecter_decorator  rY   zHMatchersVisitLeaveDecoratorTypingTest.test_bad_visit_collecter_decoratorc                 C   rN   )Nc                   @   r\   )z]MatchersVisitLeaveDecoratorTypingTest.test_bad_leave_collecter_decorator.<locals>.TestVisitorr   r$   r
   Nc                 S   r   r   r   r&   r   r   r   leave_SimpleString  r'   zpMatchersVisitLeaveDecoratorTypingTest.test_bad_leave_collecter_decorator.<locals>.TestVisitor.leave_SimpleStringr   r   r   r   r   r   r   r   r   r   r   r   r     r^   r   M@leave should not decorate functions that are concrete visit or leave methodsrV   r!   r   r   r   "test_bad_leave_collecter_decorator  ra   zHMatchersVisitLeaveDecoratorTypingTest.test_bad_leave_collecter_decoratorc                 C   rN   )Nc                   @   r   )z]MatchersVisitLeaveDecoratorTypingTest.test_bad_visit_transform_decorator.<locals>.TestVisitorr   r
   Nc                 S   r   r   r   r   r   r   r   r     r   zpMatchersVisitLeaveDecoratorTypingTest.test_bad_visit_transform_decorator.<locals>.TestVisitor.visit_SimpleStringr   r   r   r   r   r     rT   r   r   rZ   r!   r   r   r   "test_bad_visit_transform_decorator  rY   zHMatchersVisitLeaveDecoratorTypingTest.test_bad_visit_transform_decoratorc                 C   rN   )Nc                   @   s4   e Zd Zee dejdejdejfddZdS )z]MatchersVisitLeaveDecoratorTypingTest.test_bad_leave_transform_decorator.<locals>.TestVisitorr   r$   r
   c                 S   r%   r   r   r&   r   r   r   r     r'   zpMatchersVisitLeaveDecoratorTypingTest.test_bad_leave_transform_decorator.<locals>.TestVisitor.leave_SimpleStringNr   r   r   r   r   r     r,   r   r   rZ   r!   r   r   r   "test_bad_leave_transform_decorator  ra   zHMatchersVisitLeaveDecoratorTypingTest.test_bad_leave_transform_decoratorc                 C   sB   t dd}t|}t|}| |j|j | |j|j d S )Nfuncmessage)r   pickledumpsloadsassertEqualr   r   )r   original
serializedunserializedr   r   r   test_pickleable_exception  s
   


z?MatchersVisitLeaveDecoratorTypingTest.test_pickleable_exception)r
   N))r   r   r   r"   r)   r-   r3   r5   r9   r:   r<   r?   rA   rD   rJ   rM   rX   r[   r`   rb   rd   re   rf   rk   rn   ro   rp   rq   rv   rw   rz   r{   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r	      sN    




	
	
	
	
	

	

























r	   )r   typingr   libcstr   libcst.matchersmatchersr   r   r   r   r   r   libcst.testing.utilsr   r	   r   r   r   r   <module>   s   