HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.6/test/__pycache__/test_funcattrs.cpython-36.pyc
3


 \�2�@s�ddlZddlZdd�ZGdd�dej�ZGdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Z	dd�Z
ddd�ZGdd�dej�ZGdd�dej�Z
Gdd�dej�Zedkr�ej�dS)�Ncsdd���fdd�S)NcSsGdd�d�}dd�a|S)Nc@seZdZdS)z;global_function.<locals>.inner_function.<locals>.LocalClassN)�__name__�
__module__�__qualname__�rr�&/usr/lib64/python3.6/test_funcattrs.py�
LocalClasssrcSsdd�}|S)NcSsdS)Nrrrrr�inner_function2sz.inner_global_function.<locals>.inner_function2r)rrrr�inner_global_function
sr	)r	)rrrr�inner_functionsz'global_function.<locals>.inner_functioncs�S)Nrr)r
rr�<lambda>sz!global_function.<locals>.<lambda>rrr)r
r�global_functions	rc@seZdZdd�Zdd�ZdS)�
FuncAttrsTestcCs.Gdd�d�}dd�}|�|_||_||_dS)Nc@seZdZdd�ZdS)zFuncAttrsTest.setUp.<locals>.FcSsdS)Nr)�selfrrr�asz FuncAttrsTest.setUp.<locals>.F.aN)rrrrrrrr�FsrcSsdS)N�rrrrr�bszFuncAttrsTest.setUp.<locals>.b)�firr)rrrrrr�setUps
zFuncAttrsTest.setUpcCsnyt|||�Wn|k
r$YnX|jd||f�yt||�Wn|k
rZYnX|jd|�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_attrszFuncAttrsTest.cannot_set_attrN)rrrrrrrrrr
s
r
c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�FunctionPropertiesTestcCs|j|jjt�dS)N)�assertEqualrrr)rrrr�test_module.sz"FunctionPropertiesTest.test_modulecCs@d|j_|jdt|j�d�d|jj_|jdt|jj�d�dS)N��
known_attrz+set attributes not in dir listing of methodzEset attribute on function implementations, should show up in next dir)rr!ZassertIn�dirrrr)rrrr�test_dir_includes_correct_attrs1s

z6FunctionPropertiesTest.test_dir_includes_correct_attrscCsdd�}|j|j|�dS)NcSsdS)zmy docstringrrrrrr�	duplicate<szJFunctionPropertiesTest.test_duplicate_function_equality.<locals>.duplicate)ZassertNotEqualr)rr$rrr� test_duplicate_function_equality:sz7FunctionPropertiesTest.test_duplicate_function_equalitycCs2dd�}|j|�d�|jj|_|j|�d�dS)NcSsdS)Nrrrrr�testBsz:FunctionPropertiesTest.test_copying___code__.<locals>.testr)rr�__code__)rr&rrr�test_copying___code__As
z,FunctionPropertiesTest.test_copying___code__cCs,|j|jjt��|j|jddttf�dS)N�__globals__�)�assertIsrr)�globalsr�AttributeError�	TypeError)rrrr�test___globals__Gsz'FunctionPropertiesTest.test___globals__csZd��fdd�}|j}|j|t�|jt|�d�|j|djjd�|j|d|t�dS)N�cst��dS)N)�printr)rrr�fNsz2FunctionPropertiesTest.test___closure__.<locals>.f�r�cell�__closure__)	r5ZassertIsInstance�tupler�len�	__class__rrr-)rr2�cr)rr�test___closure__Lsz'FunctionPropertiesTest.test___closure__csD�fdd�}y|jdjWntk
r0YnX|jd�d�dS)Ncst��dS)N)r1r)rrrr2Wsz1FunctionPropertiesTest.test_empty_cell.<locals>.frz'shouldn't be able to read an empty cellr0)r5�
cell_contents�
ValueErrorr)rr2r)rr�test_empty_cellVs
z&FunctionPropertiesTest.test_empty_cellcCs�|j|jjd�d|j_|j|jjd�d|j_|j|jjd�|j|jddt�d}t|dii�|j|jjjd�|j|jjddt�dS)	Nrr9�drr zdef f(): pass
f.__name__�__builtins__r)	rrrrr.�execrrr-)r�srrr�
test___name__`sz$FunctionPropertiesTest.test___name__cCs�|j|jjd�|jtjjd�|jtjd�|jt�jd�|jt��jd�|jt���jd�|jtjd�|jt�jd�d	|j_|j|jjd	�d
|j_|j|jjd
�|j|jddt�dS)
NzFuncAttrsTest.setUp.<locals>.bzFuncAttrsTest.setUprz!global_function.<locals>.<lambda>z'global_function.<locals>.inner_functionz;global_function.<locals>.inner_function.<locals>.LocalClassr	z.inner_global_function.<locals>.inner_function2r9r>rr )	rrrr
rrr	rr.)rrrr�test___qualname__ps 
z(FunctionPropertiesTest.test___qualname__csd\��dd�}dd�}�fdd�}�fd	d
�}��fdd�}x*|||||gD]}|jt|j�tj�qNW|j|�d�|j|�d�|j|_|j|j|j�|j|�d�y|j|_Wntk
r�YnX|jd
�y|j|_Wntk
r�YnX|jd
�dS)Nr �cSsdS)Nrrrrrr�sz/FunctionPropertiesTest.test___code__.<locals>.acSsdS)Nr0rrrrrr�sz/FunctionPropertiesTest.test___code__.<locals>.bcs�S)Nrr)�num_onerrr9�sz/FunctionPropertiesTest.test___code__.<locals>.ccs�S)Nrr)�num_tworrr>�sz/FunctionPropertiesTest.test___code__.<locals>.dcs��fS)Nrr)rErFrr�e�sz/FunctionPropertiesTest.test___code__.<locals>.ezC__code__ with different numbers of free vars should not be possible)r rD)r�typer'�types�CodeTyper<r)rrrr9r>rG�funcr)rErFr�
test___code__�s.
z$FunctionPropertiesTest.test___code__cCs*|j|jjd�|j`|j|jjd�dS)N)rr�__defaults__)rrrr�test_blank_func_defaults�sz/FunctionPropertiesTest.test_blank_func_defaultscCs�dd�}ddd�}|j|jd�|j|jd�d
|_|j|jd�|j|�d�|j|d�d�|j|dd�d	�|`|j|jd�y
|�Wntk
r�YnX|jd
�dS)NcSs||S)Nr)rrrrr�
first_func�szAFunctionPropertiesTest.test_func_default_args.<locals>.first_funcr3r*cSs||S)Nr)rrrrr�second_func�szBFunctionPropertiesTest.test_func_default_args.<locals>.second_funcr�rDzE__defaults__ does not update; deleting it does not remove requirement)r3r*)r3r*)r3r*)r3r*)rrMr.r)rrOrPrrr�test_func_default_args�s 

z-FunctionPropertiesTest.test_func_default_argsN)rrrrr#r%r(r/r:r=rBrCrLrNrRrrrrr,s	

rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�InstancemethodAttrTestcCs0|j|jjjj|j�|j|jjd|jt�dS)Nr8)rrr�__self__r8rrr.)rrrr�test___class__�sz%InstancemethodAttrTest.test___class__cCs2|j|jjj|jj�|j|jjd|jjt�dS)N�__func__)rrrrVrrr-)rrrr�
test___func__�sz$InstancemethodAttrTest.test___func__cCs.|j|jjj|j�|j|jjd|jt�dS)NrT)rrrrTrr-)rrrr�
test___self__�sz$InstancemethodAttrTest.test___self__c
Csptjt|j�|j_|j|jj�t|j��y|jjjWntk
rLYnX|jd�|j|jjddt�dS)Nz4using unknown attributes should raise AttributeError�unknown_attrr*)	rI�
MethodType�idrrrYr-rr)rrrr�test___func___non_method�s
z/InstancemethodAttrTest.test___func___non_methodN)rrrrUrWrXr\rrrrrS�srSc@s$eZdZdd�Zdd�Zdd�ZdS)�ArbitraryFunctionAttrTestcCsJd|j_|j|jjd�yd|jj_Wntk
r:YnX|jd�dS)Nr z0setting attributes on methods should raise error)rr!rrrr-r)rrrr�
test_set_attr�sz'ArbitraryFunctionAttrTest.test_set_attrcCs.y
|j`Wntk
rYnX|jd�dS)Nz1deleting unknown attribute should raise TypeError)rrYr-r)rrrr�test_delete_unknown_attr�s

z2ArbitraryFunctionAttrTest.test_delete_unknown_attrcCsFx@|j|jjgD].}y
|jWntk
r2YqX|jd�qWdS)Nz4using unknown attributes should raise AttributeError)rrrZnon_existent_attrr-r)rrKrrr�test_unset_attr�s
z)ArbitraryFunctionAttrTest.test_unset_attrN)rrrr^r_r`rrrrr]�s
r]c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�FunctionDictsTestcCsD|j|jddt�ddlm}|ddi�}|j|jjjd|t�dS)N�__dict__r)�UserDictr!r )rrr.�collectionsrcrrrV)rrcr>rrr�test_setting_dict_to_invalid�sz.FunctionDictsTest.test_setting_dict_to_invalidcCs�ddi}||j_|j||jj�||jj_|j||jjjj�|j||jjj�|j|jjd�|j|jjdd�|j|jjjjd�|j|jjjd�dS)Nr!r )	rrbr+rrrrVrr!)rr>rrr�test_setting_dict_to_valids
z,FunctionDictsTest.test_setting_dict_to_validcCs.y
|j`Wntk
rYnX|jd�dS)Nz3deleting function dictionary should raise TypeError)rrbr.r)rrrr�test_delete___dict__s

z&FunctionDictsTest.test_delete___dict__cCs|j|jji�dS)N)rrrb)rrrr�test_unassigned_dictsz&FunctionDictsTest.test_unassigned_dictcCs(d}i}|||j<|j||j|�dS)NzSome string)rr)rrr>rrr�test_func_as_dict_keys
z'FunctionDictsTest.test_func_as_dict_keyN)rrrrerfrgrhrirrrrra�s
rac@seZdZdd�Zdd�ZdS)�FunctionDocstringTestcCs`|j|jjd�d}||j_||jj_|j|jj|�|j|jjj|�|j|jjd|t�dS)NzA test method that does nothing�__doc__)rrrkrrrrr-)rZdocstrrrr�test_set_docstring_attr$s
z-FunctionDocstringTest.test_set_docstring_attrcCs"d|j_|j`|j|jjd�dS)Nz
The docstring)rrkr)rrrr�test_delete_docstring-sz+FunctionDocstringTest.test_delete_docstringN)rrrrlrmrrrrrj#s	rjcs�fdd�}|�|jdS)z)Create a cell containing the given value.cst��dS)N)r1r)rrrr25szcell.<locals>.fr)r5)rr2r)rrr43sr4Tcs�fdd�}|sd�|jdS)zCreate an empty cell.cst��dS)N)r1r)rrrr2<szempty_cell.<locals>.fi�r)r5)�emptyr2r)rr�
empty_cell:sroc@seZdZdd�ZdS)�CellTestcCsj|jtd�td�k�|jt�td�k�|jt�t�k�|jtd�td�k�|jtd�t�k�dS)	Nr*rZsaturday�$gB@Ti���gB�)�
assertTruer4ro)rrrr�test_comparisonGs
zCellTest.test_comparisonN)rrrrsrrrrrpFsrpc@seZdZdd�ZdS)�StaticMethodAttrsTestcCs<dd�}t|�}|j|j|k�t|�}|j|j|k�dS)NcSsdS)Nrrrrrr2Usz4StaticMethodAttrsTest.test_func_attribute.<locals>.f)�classmethodrrrV�staticmethod)rr2r9rArrr�test_func_attributeTs
z)StaticMethodAttrsTest.test_func_attributeN)rrrrwrrrrrtSsrtc@seZdZdd�ZdS)�BuiltinFunctionPropertiesTestcCs�ddl}|jtjd�|j|jjd�|jtjjd�|jtjjd�|jtj	jd�|jt
j	jd�|jdd	d
gjjd�|jdd
ijjd�dS)Nrr7�timez
dict.fromkeyszfloat.__getformat__z
str.maketranszbytes.maketransr3r*rzlist.appendZfooZbarzdict.pop)
ryrr7r�dict�fromkeys�float�
__getformat__�str�	maketrans�bytes�append�pop)rryrrr�test_builtin__qualname__cs
z6BuiltinFunctionPropertiesTest.test_builtin__qualname__N)rrrr�rrrrrx_srx�__main__)T)rIZunittestrZTestCaser
rrSr]rarjr4rorprtrxr�mainrrrr�<module>s 
)