Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_funcattrs.cpython-310.pyc
o

�9jp;�@s�ddlZddlZddlZdd�ZGdd�dej�ZGdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�Z	Gdd�de�Z
dd�Zddd�ZGdd�dej�Z
Gdd�dej�ZGdd�dej�Zedkroe��dSdS)�Ncsdd���fdd�S)NcSsGdd�d�}dd�a|S)Nc@seZdZdS)�;global_function.<locals>.inner_function.<locals>.LocalClassN)�__name__�
__module__�__qualname__�rr�*/usr/lib/python3.10/test/test_funcattrs.py�
LocalClasssrcSsdd�}|S)NcS�dS�Nrrrrr�inner_function2��.inner_global_function.<locals>.inner_function2r)rrrr�inner_global_functionsr)r)rrrr�inner_functions�'global_function.<locals>.inner_functionc��Sr
rr�rrr�<lambda>��!global_function.<locals>.<lambda>rrrrr�global_functions	rc@�eZdZdd�Zdd�ZdS)�
FuncAttrsTestcCs.Gdd�d�}dd�}|�|_||_||_dS)Nc@�eZdZdd�ZdS)zFuncAttrsTest.setUp.<locals>.FcSr	r
r��selfrrr�arz FuncAttrsTest.setUp.<locals>.F.aN)rrrrrrrr�F�rcS�dS)N�rrrrr�br�FuncAttrsTest.setUp.<locals>.b)�firr!)rrr!rrr�setUps

�FuncAttrsTest.setUpcCslzt|||�Wn	|yYn
w|�d||f�zt||�Wn
|y,YdSw|�d|�dS)Nz!shouldn't be able to set %s to %rzshouldn't be able to del %s)�setattr�fail�delattr)r�obj�name�value�
exceptionsrrr�cannot_set_attrs��zFuncAttrsTest.cannot_set_attrN)rrrr$r-rrrrrs
rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �FunctionPropertiesTestcCs|�|jjt�dSr
)�assertEqualr!rrrrrr�test_module/�z"FunctionPropertiesTest.test_modulecCs@d|j_|�dt|j�d�d|jj_|�dt|jj�d�dS)N��
known_attrz+set attributes not in dir listing of methodzEset attribute on function implementations, should show up in next dir)r!r3�assertIn�dirrrr#rrrr�test_dir_includes_correct_attrs2s�
z6FunctionPropertiesTest.test_dir_includes_correct_attrscCsdd�}|�|j|�dS)NcSr)zmy docstringr rrrrr�	duplicate=szJFunctionPropertiesTest.test_duplicate_function_equality.<locals>.duplicate)�assertNotEqualr!)rr7rrr� test_duplicate_function_equality;sz7FunctionPropertiesTest.test_duplicate_function_equalitycCs2dd�}|�|�d�|jj|_|�|�d�dS)NcSr	r
rrrrr�testCrz:FunctionPropertiesTest.test_copying___code__.<locals>.testr )r/r!�__code__)rr:rrr�test_copying___code__Bs
z,FunctionPropertiesTest.test_copying___code__cCs,|�|jjt��|�|jddttf�dS)N�__globals__�)�assertIsr!r=�globalsr-�AttributeError�	TypeErrorrrrr�test___globals__Hs�z'FunctionPropertiesTest.test___globals__cCs�|�|jjt�|�|jddttf�dd�}i}t|�|j|�}|�|j|�|�|jt�|�	|d�d�|�	|i�t
�d�}ddi}t|d	�}t||�|�|d
j|�|�|dj|�|�|d
jd|�|�
d|dj�dS)N�__builtins__r>cSst|�Sr
)�len)�srrr�funcT�z6FunctionPropertiesTest.test___builtins__.<locals>.func�abcr z\
            def func3(s): pass
            func4 = type(func3)(func3.__code__, {})
        �None)�typerD�func3�func4)r?r!rDr-rArBrKr;r=r/�textwrap�dedent�exec�assertNotIn)rrG�ns�func2�code�
safe_builtinsrrr�test___builtins__Ms&�


z(FunctionPropertiesTest.test___builtins__csZd��fdd�}|j}|�|t�|�t|�d�|�|djjd�|�|d|t�dS)N�c�t��dSr
��printr�rrr�fn�z2FunctionPropertiesTest.test___closure__.<locals>.f�r�cell�__closure__)	r`�assertIsInstance�tupler/rE�	__class__rr-rA�rr\�crr[r�test___closure__lsz'FunctionPropertiesTest.test___closure__cCs^t�d�}|�|jd�t��}d}|jt|d��|jWd�dS1s(wYdS)Nr^�'shouldn't be able to read an empty cell)�msg)�types�CellTyper/�
cell_contents�assertRaises�
ValueError)r�cell_objrhrrr�
test_cell_newvs
"�z$FunctionPropertiesTest.test_cell_newcsH�fdd�}z|jdjWntyYd�dSw|�d�d�dS)NcrXr
rYrr[rrr\�r]z1FunctionPropertiesTest.test_empty_cell.<locals>.frrgrW)r`rkrmr')rr\rr[r�test_empty_cells�
z&FunctionPropertiesTest.test_empty_cellcs�d��fdd�}|j}d|d_|�|djd�|�|�d�|��d�|d`z|djWn	ty:Ynw|�d�|�t��|�Wd�n1sSwY|�t��
t��Wd�dS1smwYdS)NrWcrr
rrr[rrr\�rz/FunctionPropertiesTest.test_set_cell.<locals>.f�	rrg)	r`rkr/rmr'rl�	NameError�UnboundLocalErrorrZrdrr[r�
test_set_cell�s(
�
�
"�z$FunctionPropertiesTest.test_set_cellcCs�|�|jjd�d|j_|�|jjd�d|j_|�|jjd�|�|jddt�d}t|dii�|�|jjjd�|�|jjddt�dS)	Nr!re�drr2zdef f(): pass
f.__name__rDr)	r/r!rr-rBrPr#rrA)rrFrrr�
test___name__�sz$FunctionPropertiesTest.test___name__cCs�|�|jjd�|�tjjd�|�tjd�|�t�jd�|�t��jd�|�t���jd�|�tjd�|�t�jd�d	|j_|�|jjd	�d
|j_|�|jjd
�|�|jddt�dS)
Nr"r%rrrrrr
rerurr2)	r/r!rrr$rrr-rBrrrr�test___qualname__�s&
���z(FunctionPropertiesTest.test___qualname__csd\��dd�}dd�}�fdd�}�fdd	�}��fd
d�}|||||fD]}|�t|j�tj�q&|�|�d�|�|�d
�|j|_|�|j|j�|�|�d�z|j|_Wn	tycYnw|�d�z|j|_Wn
tyyYdSw|�d�dS)N)r2�cSr	r
rrrrrr�rz/FunctionPropertiesTest.test___code__.<locals>.acSr)NrWrrrrrr!�rz/FunctionPropertiesTest.test___code__.<locals>.bcrr
rr)�num_onerrre�rz/FunctionPropertiesTest.test___code__.<locals>.ccrr
rr)�num_tworrru�rz/FunctionPropertiesTest.test___code__.<locals>.dcs��fSr
rr�ryrzrr�e�rHz/FunctionPropertiesTest.test___code__.<locals>.er2rxzC__code__ with different numbers of free vars should not be possible)r/rKr;ri�CodeTypermr')rrr!rerur|rGrr{r�
test___code__�s2�
�z$FunctionPropertiesTest.test___code__cCs*|�|jjd�|j`|�|jjd�dSr
)r/r!�__defaults__rrrr�test_blank_func_defaults�sz/FunctionPropertiesTest.test_blank_func_defaultscCs�dd�}ddd�}|�|jd�|�|jd�d|_|�|jd�|�|�d�|�|d�d	�|�|dd	�d
�|`|�|jd�z|�Wn
tyQYdSw|�d�dS)NcS�||Sr
r�rr!rrr�
first_func��zAFunctionPropertiesTest.test_func_default_args.<locals>.first_funcr^r>cSr�r
rr�rrr�second_func�r�zBFunctionPropertiesTest.test_func_default_args.<locals>.second_func)r^r>r �rxzE__defaults__ does not update; deleting it does not remove requirement)r/rrBr')rr�r�rrr�test_func_default_args�s"

�z-FunctionPropertiesTest.test_func_default_argsN)rrrr0r6r9r<rCrVrfrorprtrvrwr~r�r�rrrrr.-s 	
	
r.c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�InstancemethodAttrTestcCs0|�|jjjj|j�|�|jjd|jt�dS)Nrc)r/r#r�__self__rcrr-rBrrrr�test___class__�sz%InstancemethodAttrTest.test___class__cCs2|�|jjj|jj�|�|jjd|jjt�dS)N�__func__)r/r#rr�rr-rArrrr�
test___func__sz$InstancemethodAttrTest.test___func__cCs.|�|jjj|j�|�|jjd|jt�dS)Nr�)r/r#rr�r-rArrrr�
test___self__sz$InstancemethodAttrTest.test___self__cCsnt�t|j�|j_|�|j��t|j��z|jjjWn	ty%Ynw|�d�|�|jjddt�dS)N�4using unknown attributes should raise AttributeError�unknown_attrr>)	ri�
MethodType�idr#r/r�rAr'r-rrrr�test___func___non_method	s�
z/InstancemethodAttrTest.test___func___non_methodN)rrrr�r�r�r�rrrrr��s
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�ArbitraryFunctionAttrTestcCsJd|j_|�|jjd�zd|jj_Wn
tyYdSw|�d�dS)Nr2z0setting attributes on methods should raise error)r!r3r/r#rrAr'rrrr�
test_set_attrs�z'ArbitraryFunctionAttrTest.test_set_attrcC�.z|j`Wn
tyYdSw|�d�dS)Nz1deleting unknown attribute should raise TypeError)r!r�rAr'rrrr�test_delete_unknown_attr$�
�z2ArbitraryFunctionAttrTest.test_delete_unknown_attrc	Cs@|j|jjfD]}z|jWn	tyYqw|�d�qdS)Nr�)r!r#r�non_existent_attrrAr')rrGrrr�test_unset_attr,s
��z)ArbitraryFunctionAttrTest.test_unset_attrN)rrrr�r�r�rrrrr�s
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�FunctionDictsTestcCsD|�|jddt�ddlm}|ddi�}|�|jjjd|t�dS)N�__dict__r)�UserDictr3r2)r-r!rB�collectionsr�r#rr�)rr�rurrr�test_setting_dict_to_invalid8sz.FunctionDictsTest.test_setting_dict_to_invalidcCs�ddi}||j_|�||jj�||jj_|�||jjjj�|�||jjj�|�|jjd�|�|jjdd�|�|jjjjd�|�|jjjd�dS)Nr3r2)	r!r�r?rrr#r�r/r3)rrurrr�test_setting_dict_to_valid>s
z,FunctionDictsTest.test_setting_dict_to_validcCr�)Nz3deleting function dictionary should raise TypeError)r!r�rBr'rrrr�test_delete___dict__Nr�z&FunctionDictsTest.test_delete___dict__cCs|�|jji�dSr
)r/r!r�rrrr�test_unassigned_dictVr1z&FunctionDictsTest.test_unassigned_dictcCs(d}i}|||j<|�||j|�dS)NzSome string)r!r/)rr+rurrr�test_func_as_dict_keyYs
z'FunctionDictsTest.test_func_as_dict_keyN)rrrr�r�r�r�r�rrrrr�7sr�c@r)�FunctionDocstringTestcCs`|�|jjd�d}||j_||jj_|�|jj|�|�|jjj|�|�|jjd|t�dS)NzA test method that does nothing�__doc__)r/r!r�rrr#r-rA)r�docstrrrr�test_set_docstring_attras
z-FunctionDocstringTest.test_set_docstring_attrcCs"d|j_|j`|�|jjd�dS)Nz
The docstring)r!r�r/rrrr�test_delete_docstringjsz+FunctionDocstringTest.test_delete_docstringN)rrrr�r�rrrrr�`s	r�cs�fdd�}|�|jdS)z)Create a cell containing the given value.crXr
rYrr[rrr\r�zcell.<locals>.fr�r`)r+r\rr[rr_ps
r_Tcs�fdd�}|s
d�|jdS)zCreate an empty cell.crXr
rYrr[rrr\yr�zempty_cell.<locals>.fi�rr�)�emptyr\rr[r�
empty_cellws
r�c@r)�CellTestcCsj|�td�td�k�|�t�td�k�|�t�t�k�|�td�td�k�|�td�t�k�dS)Nr>r �saturdayi���gB�T)�
assertTruer_r�rrrr�test_comparison�s
zCellTest.test_comparisonN)rrrr�rrrrr��rr�c@r)�StaticMethodAttrsTestcCs<dd�}t|�}|�|j|u�t|�}|�|j|u�dS)NcSr	r
rrrrrr\�rz4StaticMethodAttrsTest.test_func_attribute.<locals>.f)�classmethodr�r��staticmethod)rr\rerFrrr�test_func_attribute�s
z)StaticMethodAttrsTest.test_func_attributeN)rrrr�rrrrr��rr�c@r)�BuiltinFunctionPropertiesTestcCs�ddl}|�tjd�|�|jjd�|�tjjd�|�tjjd�|�tj	jd�|�t
j	jd�|�gd�jjd	�|�d
dijjd�dS)
NrrE�timez
dict.fromkeyszfloat.__getformat__z
str.maketranszbytes.maketrans)r^r>r zlist.append�foo�barzdict.pop)
r�r/rEr�dict�fromkeys�float�
__getformat__�str�	maketrans�bytes�append�pop)rr�rrr�test_builtin__qualname__�s
�z6BuiltinFunctionPropertiesTest.test_builtin__qualname__N)rrrr�rrrrr��sr��__main__)T)rNri�unittestr�TestCaserr.r�r�r�r�r_r�r�r�r�r�mainrrrr�<module>s&
O)

�

Youez - 2016 - github.com/yon3zu
LinuXploit