Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_dynamic.cpython-39.pyc

a

��g*�@sFddlZddlZddlmZmZGdd�dej�ZedkrBe��dS)�N)�	swap_item�	swap_attrc@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�RebindBuiltinsTestsz=Test all the ways that we can change/shadow globals/builtins.cGsdS)a�Perform TestCase-specific configuration on a function before testing.

        By default, this does nothing. Example usage: spinning a function so
        that a JIT will optimize it. Subclasses should override this as needed.

        Args:
            func: function to configure.
            *args: any arguments that should be passed to func, if calling it.

        Returns:
            Nothing. Work will be performed on func in-place.
        N�)�self�func�argsrr�-/usr/local/lib/python3.9/test/test_dynamic.py�configure_func
s
z"RebindBuiltinsTests.configure_funccCsddd�}|�|�|�|�d�tt�ddd���|�|�d�Wd�n1sV0YdS)NcSstgd��S�N)�����lenrrrr	�foosz=RebindBuiltinsTests.test_globals_shadow_builtins.<locals>.foorrcSsdS�N�r��xrrr	�<lambda>#�zBRebindBuiltinsTests.test_globals_shadow_builtins.<locals>.<lambda>r�r
�assertEqualr�globals�rrrrr	�test_globals_shadow_builtinss

z0RebindBuiltinsTests.test_globals_shadow_builtinscCsbdd�}|�|�|�|�d�ttddd���|�|�d�Wd�n1sT0YdS)NcSstgd��Srrrrrr	r(sz5RebindBuiltinsTests.test_modify_builtins.<locals>.foorrcSsdSrrrrrr	r-rz:RebindBuiltinsTests.test_modify_builtins.<locals>.<lambda>r)r
rr�builtinsrrrr	�test_modify_builtins&s

z(RebindBuiltinsTests.test_modify_builtinscCsldd�}|�|�|�}|�t|�d�ttddd��� |�t|�d�Wd�n1s^0YdS)Ncss td�}t|�Vt|�VdS�Nr��rangerrrrr	r2s
zLRebindBuiltinsTests.test_modify_builtins_while_generator_active.<locals>.foorrcSsdSrrrrrr	r:rzQRebindBuiltinsTests.test_modify_builtins_while_generator_active.<locals>.<lambda>r)r
r�nextrr�rr�grrr	�+test_modify_builtins_while_generator_active0s
z?RebindBuiltinsTests.test_modify_builtins_while_generator_activecCsdttdt��Ddd�}dd�}|�|dd��|�||�dd	g�Wd�n1sV0YdS)
NrcSsdd�t_dS)NcSsdS)N�rrrrr	rBrzZRebindBuiltinsTests.test_modify_builtins_from_leaf_function.<locals>.bar.<locals>.<lambda>)rrrrrr	�barAszHRebindBuiltinsTests.test_modify_builtins_from_leaf_function.<locals>.barcSs2g}|�ttd���|�|�ttd���|Sr)�appendrr!)�modifier�lrrr	rDs
zHRebindBuiltinsTests.test_modify_builtins_from_leaf_function.<locals>.foocSsdS)Nrrrrr	rJrzMRebindBuiltinsTests.test_modify_builtins_from_leaf_function.<locals>.<lambda>rr&)rrrr
r)rr'rrrr	�'test_modify_builtins_from_leaf_function=s
z;RebindBuiltinsTests.test_modify_builtins_from_leaf_functioncCsZdd�}|�|�ddd�i}||dd�d�}|�td|�d	�|�tdd
|i�d	�dS)NcSstgd��Srrrrrr	rOszQRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_eval.<locals>.foorcSsdSrrrrrr	rTrzVRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_eval.<locals>.<lambda>cSsdS�N�rrrrr	rVr�r�__builtins__rzfoo()rr)r
r�eval)rr�
builtins_dict�globals_dictrrr	�0test_cannot_change_globals_or_builtins_with_evalNs
�zDRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_evalcCsndd�}|�|�d|i}td|�|�|dd�ddd	�i}||d
d	�d�}td|�|�|dd�dS)NcSstgd��Srrrrrr	r\szQRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_exec.<locals>.foorz	x = foo()rrrcSsdSrrrrrr	rerzVRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_exec.<locals>.<lambda>cSsdSr,rrrrr	rgrr.)r
�execr)rrr2r1rrr	�0test_cannot_change_globals_or_builtins_with_exec[s

�
zDRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_execcCsrdd�}|�|�|�}|�t|�d�tt�dddd�i�� |�t|�d�Wd�n1sd0YdS)Ncss td�}t|�Vt|�VdSrr rrrr	rms
zORebindBuiltinsTests.test_cannot_replace_builtins_dict_while_active.<locals>.foorr/rcSsdSrrrrrr	rurzTRebindBuiltinsTests.test_cannot_replace_builtins_dict_while_active.<locals>.<lambda>)r
rr"rrr#rrr	�.test_cannot_replace_builtins_dict_while_activels
zBRebindBuiltinsTests.test_cannot_replace_builtins_dict_while_activecCshdd�}|�|�|�|�d�tt�dddd�i��|�|�d�Wd�n1sZ0YdS)NcSstgd��Srrrrrr	ryszPRebindBuiltinsTests.test_cannot_replace_builtins_dict_between_calls.<locals>.foorr/rcSsdSrrrrrr	r~rzURebindBuiltinsTests.test_cannot_replace_builtins_dict_between_calls.<locals>.<lambda>rrrrr	�/test_cannot_replace_builtins_dict_between_callsxs

zCRebindBuiltinsTests.test_cannot_replace_builtins_dict_between_callscCs2ddd�i}td|�}|�|�|�|�d�dS)NrcSsdSrrrrrr	r�rzKRebindBuiltinsTests.test_eval_gives_lambda_custom_globals.<locals>.<lambda>zlambda: len([])r)r0r
r)rr2rrrr	�%test_eval_gives_lambda_custom_globals�s

z9RebindBuiltinsTests.test_eval_gives_lambda_custom_globalsN)�__name__�
__module__�__qualname__�__doc__r
rrr%r+r3r5r6r7r8rrrr	r	s



	r�__main__)	rZunittestZtest.supportrrZTestCaserr9�mainrrrr	�<module>s

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