Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_decorators.cpython-312.opt-2.pyc

�

'Μg�:����ddlZddlmZd�ZGd�de�ZGd�de�Zdd�Zd	�Z	d
�Z
Gd�dej�ZGd
�dej�Z
edk(rej�yy)�N)�
MethodTypec����fd�}|S)Nc�>��|jj��|S�N)�__dict__�update)�func�kwdss ��1/usr/local/lib/python3.12/test/test_decorators.py�decoratezfuncattrs.<locals>.decorates����
�
���T�"����)r
rs` r�	funcattrsrs�����Or
c��eZdZed��Zy)�MiscDecoratorsc����fd�}|S)Nc�&���|jd<|S)N�author)r)r	�names �rrz'MiscDecorators.author.<locals>.decorate
s���&*�D�M�M�(�#��Kr
r)rrs` rrzMiscDecorators.authors���	��r
N)�__name__�
__module__�__qualname__�staticmethodrrr
rrr
s�����r
rc��eZdZd�Zy)�DbcheckErrorc�J�tj|d|�d|�d|�d|�d�	�y)Nzdbcheck z failed (func=z args=z kwds=�))�	Exception�__init__)�self�exprstrr	�argsr
s     rrzDbcheckError.__init__s �����4�#�T�4��"7�	8r
N)rrrrrr
rrrs��8r
rc�����	���fd�}|S)Nc�R����t�d�jzd�������fd�}|S)Nz
dbcheck-%s�evalc�J��t����st��||���|i|��Sr)r%r)r"r
�exprr!r	�globals�localss  �����r�checkz(dbcheck.<locals>.decorate.<locals>.checks0�����g�v�.�"�7�D�$��=�=���&��&�&r
)�compiler)r	r*r'r!r(r)s` @���rrzdbcheck.<locals>.decorates+����w��t�}�}� <�f�E��	'�	'��r
r)r!r(r)rs``` r�dbcheckr,s���1���Or
c���	�fd�}|S)Nc�J�����j�d��<���fd�}�|_|S)Nrc�.����xxdz
cc<�|i|��S)N�r)r"r
�countsr	�	func_names  ���r�callz*countcalls.<locals>.decorate.<locals>.call-s#����9���"����&��&�&r
�r)r	r3r2r1s` @�rrzcountcalls.<locals>.decorate*s)����M�M�	���y��	'�"��
��r
r)r1rs` r�
countcallsr5(s���,���Or
c�<���i���fd�}�j|_|S)Nc�d��	�|S#t$r�|�}|�|<|cYSt$r�|�cYSwxYwr)�KeyError�	TypeError)r"�resr	�saveds  ��rr3zmemoize.<locals>.call8sJ���	���;����	���+�C��E�$�K��J��	���;��	�s��/�
/�/r4)r	r3r;s` @r�memoizer<6s����E�	��M�M�D�M��Kr
c�l�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)�TestDecoratorsc��Gd�dt�}|j|j�d�|j|�j�d�y)Nc��eZdZed��Zy)�%TestDecorators.test_single.<locals>.Cc��y�N�*rrr
r�fooz)TestDecorators.test_single.<locals>.C.fooKs�� r
N)rrrrrErr
r�CrAJs��
� �� r
rFrD)�object�assertEqualrE�r rFs  r�test_singlezTestDecorators.test_singleIs>��	!��	!�	
�������"�%���������B�'r
c�:�d�}||�}|j|j|�|j|j|�dD](}|jt||�t||���*|j	t|�|j
|��|S)Nc��|Srr��xs rr	z0TestDecorators.check_wrapper_attrs.<locals>.funcQs���Hr
)rrr�__doc__�__annotations__)�assertIs�__func__�__wrapped__�getattrrH�repr�format)r �method_wrapper�
format_strr	�wrapper�attrs      r�check_wrapper_attrsz"TestDecorators.check_wrapper_attrsPs���	� ��&���
�
�g�&�&��-��
�
�g�)�)�4�0�3�D��M�M�'�'�4�0�!�$��-�
/�3�
	
����g��
�(9�(9�$�(?�@��r
c�`�|jtd�}|j|d�d�y)Nz<staticmethod({!r})>r0)r[rrH�r rYs  r�test_staticmethodz TestDecorators.test_staticmethod`s+���*�*�<�9O�P��	
������Q�'r
c�^�|jtd�}|jt|d�y)Nz<classmethod({!r})>r0)r[�classmethod�assertRaisesr9r]s  r�test_classmethodzTestDecorators.test_classmethodfs'���*�*�;�8M�N�����)�W�a�0r
c��t�}|jd�d��}|j|�d�|j|jd�y)N�Cleesec��yrCrrr
rrEz'TestDecorators.test_dotted.<locals>.fooms��r
rD)rrrH)r �
decoratorsrEs   r�test_dottedzTestDecorators.test_dottedksI��#�%�
�	�	�	�8�	$��
%��������#�������X�.r
c��d�}d}tdd��}||i|��d��}|j|�d�|j|j||f�|dd	d
d��d
��}|j|�d�|j|jdtd
d��f�|dd�d��}|j|jdif�y)Nc������fd�}|S)Nc�&��t|d��f�|S)N�dbval)�setattr)r	r"r
s ��rrz@TestDecorators.test_argforms.<locals>.noteargs.<locals>.decoratews�����g��d�|�4��r
r)r"r
rs`` r�noteargsz.TestDecorators.test_argforms.<locals>.noteargsvs���
��Or
)�Now�is�the�timer0�)�one�twoc��yrCrrr
r�f1z(TestDecorators.test_argforms.<locals>.f1~���r
rD�terry�gilliam�idle�cleese)�eric�johnc��y)N�Trrr
r�f2z(TestDecorators.test_argforms.<locals>.f2�rwr
r)rxryc��yrrrr
r�f3z(TestDecorators.test_argforms.<locals>.f3�s��r
)r0rr)�dictrHrk)r rmr"r
rvr�r�s       r�
test_argformszTestDecorators.test_argformsrs���	�.����q�!��	�4�	 �4�	 ��
!�������r�"�������D�$�<�0�	�'�9�6��	A��
B�������r�"�������$8�%)�v�H�%E�$G�	H�
�!�Q���
��������F�B�<�0r
c��td�d��}|j|dd�d�|jt|dd�y)Nzargs[1] is not Nonec��||zSrr)�a�bs  r�fz&TestDecorators.test_dbcheck.<locals>.f�s���q�5�Lr
r0rr�)r,rHrar)r r�s  r�test_dbcheckzTestDecorators.test_dbcheck�sD��	�&�	'�	�
(�	�����1�a��!�$����,��1�d�3r
c�z�i}tt|�d���}|j|jd�|j|t	d���|j|d�d�|j|dd�|j|d�d�|j|dd�|j|d�d	�|j|dd�|j|d
g�d
d
g�|j|dd�|j|d
g�d
d
g�|j|dd�y)Nc��|dzS)NrrrrMs r�doublez+TestDecorators.test_memoize.<locals>.double�s
���q�5�Lr
r�r)r�rr�r0r���
)r<r5rHrr�)r r1r�s   r�test_memoizezTestDecorators.test_memoize�s+����	�	�F�	�	�
�
�	�������(�3������Q��0�	
������A�&������)�1�-�������A�&������)�1�-�������A�&������)�1�-�	
��������B�x�0������)�1�-���������B�x�0������)�1�-r
c��dD]>}t|dd�|jt�5td|�d�dd�ddd��@dD]<}t|dd�|jt�5t	d|�d��ddd��>d�}td|�	�}d
tfdtfdtfd
tffD]/\}}d|z}t|dd�}|j|t||��1y#1swY��xYw#1swY��xYw)N)zx,zx, yzx = y�passz
import sys�test�exec�@�
def f(): pass)z1.+2jz
[1, 2][-1]z(1, 2)�Truez...�Noner%c��t�r)�NotImplementedError�r	s r�unimpz)TestDecorators.test_errors.<locals>.unimp�s��%�%r
)�nullvalr��undefr�znullval.attrr�z$@%s
def f(): pass
assert f() is None)
r+ra�SyntaxErrorr9r�r��	NameError�AttributeErrorr�r%)r �stmtr'r��context�exc�codestr�codes        r�test_errorszTestDecorators.test_errors�s
��B�D��D�&�&�)��"�"�;�/��!�D�6��1�6�6�B�0�/�B�M�D��D�&�&�)��"�"�9�-��q���o�.�/�.�-�M�
	&��t�5�1��#�Y�/�%�y�1�*�N�;�#�%8�9�;�I�D�#�?��E�G��7�F�F�3�D����c�4��w�7�
;�0�/��.�-�s�C&�+C2�&C/	�2C;	c�4�dD]}td|�d�dd��y)N)z(x,)z(x, y)zx := yz(x := y)zx @yz(x @ y)zx[0]zw[x].y.zzw + x - (y + z)z	x(y)()(z)z[w, x, y][z]zx.yr�r�r�r�)r+)r r's  r�test_expressionszTestDecorators.test_expressions�s%��
�D�
�a��v�_�-�v�v�>�	
r
c�P�Gd�dt�}|j|�j�d�|j|jjd�|j|jjd�|j|jj
d�y)Nc�D�eZdZedd��ed��d���Zy)�%TestDecorators.test_double.<locals>.Cr0�haha)�abc�xyzrD)�boohc��yrCr)r s rrEz)TestDecorators.test_double.<locals>.C.foo�s��"$r
N)rrrrrErr
rrFr��s$��
�1�&�
)�
�B�
�$� �*�$r
rFrDr0r�)rGrHrEr�r�r�rIs  r�test_doublezTestDecorators.test_double�sp��	%��	%�	
��������B�'���������A�&���������F�+���������R�(r
c�l�d�}|d�|d�d���}|j|�dd�y)Nc���	�fd�}|S)Nc����fd�S)Nc����Srr)�nums�r�<lambda>zJTestDecorators.test_order.<locals>.callnum.<locals>.deco.<locals>.<lambda>�s���sr
r)r	r�s �r�decoz8TestDecorators.test_order.<locals>.callnum.<locals>.deco�s	���"�"r
r)r�r�s` r�callnumz*TestDecorators.test_order.<locals>.callnum�s���
K�
#��Kr
rrr0c��yrCrrr
rrEz&TestDecorators.test_order.<locals>.foo�s��r
z,Application order of decorators is incorrect)rH)r r�rEs   r�
test_orderzTestDecorators.test_order�s?��	�
���	����
�
��������J�	Lr
c���	�g��fd��	G��	fd�dt�}t|gd��\}}}gd�}g�|j|j�|j|j�|j|j�d����}|j	|�d�|j	�|�g�d�}|j|j�|j|j�|j|j�|���}|j	|�d�|j	�|�y)	Nc�>����jd�z���fd�}|S)N�makedecc�0���jd�z�|S)N�calldec��append)r	�actions�tags ��rrzHTestDecorators.test_eval_order.<locals>.make_decorator.<locals>.decorate�s������y�3��/��r
r�)r�rr�s` �r�make_decoratorz6TestDecorators.test_eval_order.<locals>.make_decorator�s����N�N�9�s�?�+�
��Or
c� ��eZdZd�Z��fd�Zy)�8TestDecorators.test_eval_order.<locals>.NameLookupTracerc��||_yr)�index)r r�s  rrzATestDecorators.test_eval_order.<locals>.NameLookupTracer.__init__s	��"��
r
c���|dk(rd�}}n|dk(rdt|j�}}�jd|jfz�S)Nr��evalname�arg�evalargsz%s%d)�strr�r�)r �fname�opnamer:r�r�s    ��r�__getattr__zDTestDecorators.test_eval_order.<locals>.NameLookupTracer.__getattr__sN����,�,�#-�~�C�F��e�^�#-�s�4�:�:��C�F����v�����(<�<�=��
r
N)rrrrr�)r�r�s��r�NameLookupTracerr�s
���
#�
r
r�)r0rrr�)�	evalname1�	evalargs1�makedec1�	evalname2�	evalargs2�makedec2�	evalname3�	evalargs3�makedec3�calldec3�calldec2�calldec1c��yrCrrr
rrEz+TestDecorators.test_eval_order.<locals>.foos��r
rDc��yrCrrr
r�barz+TestDecorators.test_eval_order.<locals>.bar!s��"r
)rG�mapr�r�rH)
r r��c1�c2�c3�expected_actionsrEr�r�r�s
        @@r�test_eval_orderzTestDecorators.test_eval_order�s*�����	�	��	��)�;�7�
��B��B��
��	�	�	�2�6�6�	"�	�	�	�2�6�6�	"�	�	�	�2�6�6�	"��
#�
#�
#�	�������#�����"2�3����'�b������'�(A��(9�(9�"�&�&�(A�B[�"�BS�BS�TV�TZ�TZ�B[�\_�B`�(a�b��������#�����"2�3r
c�l����Gd�d��G�fd�d���fd��G�fd�d�}|j|j�d�|j|j�d	�|j|�j�d�|j|�j�d	�y)
Nc��eZdZd�Zd�Zy)�OTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.BoundWrapperc��||_yr�rS�r �wrappeds  rrzXTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.BoundWrapper.__init__(�
��#*�� r
c�&�|j|i|��Srr�)r r"�kwargss   r�__call__zXTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.BoundWrapper.__call__+s��'�t�'�'��8��8�8r
N)rrrrr�rr
r�BoundWrapperr�'s��
+�
9r
r�c���eZdZd�Z�fd�Zy)�JTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.Wrapperc��||_yrr�r�s  rrzSTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.Wrapper.__init__/r�r
c�L��|jj||�}�|�Sr)rS�__get__)r �instance�owner�bound_functionr�s    �rr�zRTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.Wrapper.__get__2s&���!%�!1�!1�!9�!9�(�E�!J��#�N�3�3r
N)rrrrr�)r�s�r�Wrapperr�.s
���
+�
4r
r�c����|�Srr)r�r�s �r�	decoratorzLTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.decorator6s����7�#�#r
c�F��eZdZW�ed���ZeW�d���Zy)�HTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.Classc��y�N�spamr��clss r�innerzNTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.Class.inner:s��r
c��y)N�eggsrrs r�outerzNTestDecorators.test_wrapped_descriptor_inside_classmethod.<locals>.Class.outer@s��
r
N)rrrr`r	r)rs�r�Classr9s9���
�
�
���
��
�
���
r
r
rr)rHr	r)r r
r�r�rs  @@@r�*test_wrapped_descriptor_inside_classmethodz9TestDecorators.test_wrapped_descriptor_inside_classmethod&s����	9�	9�	4�	4�	$�	�	�	
��������/���������/���������&�1���������&�1r
c�r��Gd�d��G�fd�d�}|j|j�d�y)Nc��eZdZd�Zy)�@TestDecorators.test_bound_function_inside_classmethod.<locals>.Ac��yrr�r rs  rrEzDTestDecorators.test_bound_function_inside_classmethod.<locals>.A.fooNs��r
N)rrrrErr
r�ArMs��
r
rc�>��eZdZeW��j�Zy)�@TestDecorators.test_bound_function_inside_classmethod.<locals>.BN)rrrr`rEr�)rs�r�BrQs����a�c�g�g�&�Cr
rr)rHr�)r rrs  @r�&test_bound_function_inside_classmethodz5TestDecorators.test_bound_function_inside_classmethodLs/���	�	�	'�	'�	
�������&�)r
c�|����Gd�d��Gd�d����fD�]�G���fd�d�}|j|j�|�|j|j�|�|j|j�|�|j|j	�|�|j|j�|�|j|j
�|�|�}|j|j�|�|j|j�|�|j|j�|�|j|j	�|�|j|j�|�|j|j
�|�d�}|j�|�j|��|�|j�|�j||��|�|j�|�j||��|�|j�|�j|��t|��|jt|�j|��|�|jt|�j||��|�|jt|�j||��|�|jt|�j|��t|���� y)Nc� �eZdZd�Zd�Zdd�Zy)�RTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod1c��||_yrr��r r	s  rrz[TestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod1.__init__Xs	�� ��	r
c��t|jd�r!|jj||��S|j|�S)Nr�)�hasattrr	r�rs  rr�z[TestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod1.__call__[s:���4�9�9�i�0�6�4�9�9�,�,�S�#�6�8�8��y�y��~�%r
Nc�4�|�t|�}t||�Sr��typer�r r�r�s   rr�zZTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod1.__get__`����=� ��N�E�!�$��.�.r
r�rrrrr�r�rr
r�MyClassMethod1rWs��
!�
&�

/r
r&c� �eZdZd�Zd�Zdd�Zy)�RTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod2c�J�t|t�r|j}||_yr)�
isinstancer`rRr	rs  rrz[TestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod2.__init__fs���d�K�0��=�=�D� ��	r
c�$�|j|�Srr�rs  rr�z[TestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod2.__call__ks���y�y��~�%r
Nc�4�|�t|�}t||�Srr!r#s   rr�zZTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.MyClassMethod2.__get__nr$r
rr%rr
r�MyClassMethod2r(es��
!�

&�
/r
r-c���eZdZW�d��ZeW�d���ZW�ed���Zeed���ZW�W�d���ZW�W�d���Z	y)�ETestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.Ac��|Srrrs rrvzHTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.A.f1us���Jr
c��|Srrrs rr�zHTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.A.f2y�	���Jr
c��|Srrrs rr�zHTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.A.f3~r2r
c��|Srrrs r�f4zHTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.A.f4�r2r
c��|Srrrs r�f5zHTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.A.f5�r2r
c��|Srrrs r�f6zHTestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.A.f6�r2r
N)
rrrrvr`r�r�r5r7r9)r&r-�
myclassmethods���rrr/ts����������������������������� ������ ��r
rc��|Srrrs rr�zETestDecorators.test_wrapped_classmethod_inside_classmethod.<locals>.f�s���
r
)
rQrvr�r�r5r7r9r�r"r`)r rr�r�r&r-r:s    @@@r�+test_wrapped_classmethod_inside_classmethodz:TestDecorators.test_wrapped_classmethod_inside_classmethodVs_���	/�	/�	/�	/�-�n�=�M�
�
�<
�M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$���A��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$��M�M�!�$�$�&�!�$�
�
�M�M�5�-��*�2�2�1�5�7��;��M�M�8�-��*�2�2�1�a�8�:�A�>��M�M�8�-��*�2�2�1�a�8�:�A�>��M�M�5�-��*�2�2�1�5�7��a��A��M�M�3�+�a�.�0�0��3�5�q�9��M�M�6�+�a�.�0�0��A�6�8�!�<��M�M�6�+�a�.�0�0��A�6�8�!�<��M�M�3�+�a�.�0�0��3�5�t�A�w�?�o>r
N)rrrrJr[r^rbrgr�r�r�r�r�r�r�r�rrr<rr
rr>r>GsW��(�� (�1�
/�1�64�.�68�4?�)�
L�;4�z$2�L*�T@r
r>c��eZdZd�Zd�Zd�Zy)�TestClassDecoratorsc�j�d�}|Gd�dt��}|j|jd�y)Nc��d|_|S)N�Hello��extrarMs r�plainz.TestClassDecorators.test_simple.<locals>.plain�����A�G��Hr
c��eZdZy)�*TestClassDecorators.test_simple.<locals>.CN�rrrrr
rrFrG�s��r
rFrA�rGrHrC)r rDrFs   r�test_simplezTestClassDecorators.test_simple�s0��	�
����
��������'�*r
c�z�d�}d�}||Gd�dt���}|j|jd�y)Nc��d|_|S)Nr�rBrMs r�tenz,TestClassDecorators.test_double.<locals>.ten�s���A�G��Hr
c�0�|xjdz
c_|S)N�rBrMs r�add_fivez1TestClassDecorators.test_double.<locals>.add_five�s��
�G�G�q�L�G��Hr
c��eZdZy)�*TestClassDecorators.test_double.<locals>.CNrHrr
rrFrR����r
rF�rI)r rMrPrFs    rr�zTestClassDecorators.test_double�s=��	�	�
�	����

�
��������"�%r
c�z�d�}d�}||Gd�dt���}|j|jd�y)Nc��d|_|S)N�firstrBrMs r�
applied_firstz5TestClassDecorators.test_order.<locals>.applied_first�rEr
c��d|_|S)N�secondrBrMs r�applied_secondz6TestClassDecorators.test_order.<locals>.applied_second�s���A�G��Hr
c��eZdZy)�)TestClassDecorators.test_order.<locals>.CNrHrr
rrFr]�rSr
rFrZrI)r rXr[rFs    rr�zTestClassDecorators.test_order�s=��	�	�
�	����
�
��������(�+r
N)rrrrJr�r�rr
rr>r>�s��+�&�
,r
r>�__main__)NN)�unittest�typesrrrGrrrr,r5r<�TestCaser>r>r�mainrr
r�<module>rcs{������f��8�I�8�	�
�
�"c@�X�&�&�c@�J!,�(�+�+�!,�F�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists