HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_dynamic.cpython-310.pyc
o

�i*�@sJddlZddlZddlmZmZGdd�dej�Zedkr#e��dSdS)�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.cG�dS)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.10/test/test_dynamic.py�configure_func
s
z"RebindBuiltinsTests.configure_funccCsfdd�}|�|�|�|�d�tt�ddd���|�|�d�Wd�dS1s,wYdS)NcS�tgd��S�N)�����lenrrrr
�foo�z=RebindBuiltinsTests.test_globals_shadow_builtins.<locals>.foorrcSr�N�r��xrrr
�<lambda>#�zBRebindBuiltinsTests.test_globals_shadow_builtins.<locals>.<lambda>r�r�assertEqualr�globals�rrrrr
�test_globals_shadow_builtinss
"�z0RebindBuiltinsTests.test_globals_shadow_builtinscCsddd�}|�|�|�|�d�ttddd���|�|�d�Wd�dS1s+wYdS)NcSrr
rrrrr
r(rz5RebindBuiltinsTests.test_modify_builtins.<locals>.foorrcSrrrrrrr
r-rz:RebindBuiltinsTests.test_modify_builtins.<locals>.<lambda>r)rrr�builtinsrrrr
�test_modify_builtins&s
"�z(RebindBuiltinsTests.test_modify_builtinscCsndd�}|�|�|�}|�t|�d�ttddd���|�t|�d�Wd�dS1s0wYdS)Ncs�"�td�}t|�Vt|�VdS�Nr��rangerrrrr
r2��
zLRebindBuiltinsTests.test_modify_builtins_while_generator_active.<locals>.foorrcSrrrrrrr
r:rzQRebindBuiltinsTests.test_modify_builtins_while_generator_active.<locals>.<lambda>r)rr�nextrr �rr�grrr
�+test_modify_builtins_while_generator_active0s
"�z?RebindBuiltinsTests.test_modify_builtins_while_generator_activecCsfttdt��#dd�}dd�}|�|dd��|�||�dd	g�Wd�dS1s,wYdS)
NrcSsdd�t_dS)NcSr)N�rrrrr
rBrzZRebindBuiltinsTests.test_modify_builtins_from_leaf_function.<locals>.bar.<locals>.<lambda>)r rrrrr
�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+)rr rrr)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)NcSrr
rrrrr
rOrzQRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_eval.<locals>.foorcSrrrrrrr
rTrzVRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_eval.<locals>.<lambda>cSr�N�rrrrr
rVr�r�__builtins__rzfoo()rr)rr�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)NcSrr
rrrrr
r\rzQRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_exec.<locals>.foorz	x = foo()rrrcSrrrrrrr
rerzVRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_exec.<locals>.<lambda>cSrr1rrrrr
rgrr3)r�execr)rrr7r6rrr
�0test_cannot_change_globals_or_builtins_with_exec[s

�
zDRebindBuiltinsTests.test_cannot_change_globals_or_builtins_with_execcCstdd�}|�|�|�}|�t|�d�tt�dddd�i��|�t|�d�Wd�dS1s3wYdS)Ncsr"r#r$rrrr
rmr&zORebindBuiltinsTests.test_cannot_replace_builtins_dict_while_active.<locals>.foorr4rcSrrrrrrr
rurzTRebindBuiltinsTests.test_cannot_replace_builtins_dict_while_active.<locals>.<lambda>)rrr'rrr(rrr
�.test_cannot_replace_builtins_dict_while_activels
"�zBRebindBuiltinsTests.test_cannot_replace_builtins_dict_while_activecCsjdd�}|�|�|�|�d�tt�dddd�i��|�|�d�Wd�dS1s.wYdS)NcSrr
rrrrr
ryrzPRebindBuiltinsTests.test_cannot_replace_builtins_dict_between_calls.<locals>.foorr4rcSrrrrrrr
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)NrcSrrrrrrr
r�rzKRebindBuiltinsTests.test_eval_gives_lambda_custom_globals.<locals>.<lambda>zlambda: len([])r)r5rr)rr7rrrr
�%test_eval_gives_lambda_custom_globals�s

z9RebindBuiltinsTests.test_eval_gives_lambda_custom_globalsN)�__name__�
__module__�__qualname__�__doc__rrr!r*r0r8r:r;r<r=rrrr
r	s



	r�__main__)	r ZunittestZtest.supportrrZTestCaserr>�mainrrrr
�<module>s�