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_funcattrs.cpython-39.opt-2.pyc

a

��g.6�@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�e��dS)�Ncsdd���fdd�S)NcSsGdd�d�}dd�a|S)Nc@seZdZdS)�;global_function.<locals>.inner_function.<locals>.LocalClassN)�__name__�
__module__�__qualname__�rr�//usr/local/lib/python3.9/test/test_funcattrs.py�
LocalClasssrcSsdd�}|S)NcSsdS�Nrrrrr�inner_function2s�.inner_global_function.<locals>.inner_function2r)r
rrr�inner_global_function
sr)r)rrrr�inner_functions�'global_function.<locals>.inner_functioncs�Sr	rr�r
rr�<lambda>��!global_function.<locals>.<lambda>rrrrr�global_functions	rc@seZdZdd�Zdd�ZdS)�
FuncAttrsTestcCs.Gdd�d�}dd�}|�|_||_||_dS)Nc@seZdZdd�ZdS)zFuncAttrsTest.setUp.<locals>.FcSsdSr	r��selfrrr�asz FuncAttrsTest.setUp.<locals>.F.aN)rrrrrrrr�FsrcSsdS�N�rrrrr�bs�FuncAttrsTest.setUp.<locals>.b)�firr)rrrrrr�setUps
�FuncAttrsTest.setUpcCsjzt|||�Wn|y"Yn0|�d||f�zt||�Wn|yVYn0|�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)rrrrr'rrrrrs
rc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�FunctionPropertiesTestcCs|�|jjt�dSr	)�assertEqualrrrrrrr�test_module.sz"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)rr,ZassertIn�dirrrrrrrr�test_dir_includes_correct_attrs1s�
z6FunctionPropertiesTest.test_dir_includes_correct_attrscCsdd�}|�|j|�dS)NcSsdSrrrrrr�	duplicate<szJFunctionPropertiesTest.test_duplicate_function_equality.<locals>.duplicate)ZassertNotEqualr)rr/rrr� test_duplicate_function_equality:sz7FunctionPropertiesTest.test_duplicate_function_equalitycCs2dd�}|�|�d�|jj|_|�|�d�dS)NcSsdSr	rrrrr�testBrz:FunctionPropertiesTest.test_copying___code__.<locals>.testr)r)r�__code__)rr1rrr�test_copying___code__As
z,FunctionPropertiesTest.test_copying___code__cCs,|�|jjt��|�|jddttf�dS)N�__globals__�)�assertIsrr4�globalsr'�AttributeError�	TypeErrorrrrr�test___globals__Gs�z'FunctionPropertiesTest.test___globals__csZd��fdd�}|j}|�|t�|�t|�d�|�|djjd�|�|d|t�dS)N�cst��dSr	��printr�rrr�fNrz2FunctionPropertiesTest.test___closure__.<locals>.f�r�cell�__closure__)	rBZassertIsInstance�tupler)�len�	__class__rr'r8�rr?�crr>r�test___closure__Lsz'FunctionPropertiesTest.test___closure__cCs\t�d�}|�|jd�t��}d}|jt|d��|jWd�n1sN0YdS)Nr@�'shouldn't be able to read an empty cell)�msg)�types�CellTyper)�
cell_contents�assertRaises�
ValueError)rZcell_objrJrrr�
test_cell_newVs
z$FunctionPropertiesTest.test_cell_newcsB�fdd�}z|jdjWnty.Yn0|�d�d�dS)Ncst��dSr	r<rr>rrr?`rz1FunctionPropertiesTest.test_empty_cell.<locals>.frrIr;)rBrMrOr!)rr?rr>r�test_empty_cell_s
z&FunctionPropertiesTest.test_empty_cellcs�d��fdd�}|j}d|d_|�|djd�|�|�d�|��d�|d`z|djWntytYn0|�d�|�t��|�Wd�n1s�0Y|�t��t��Wd�n1s�0YdS)Nr;cs�Sr	rrr>rrr?krz/FunctionPropertiesTest.test_set_cell.<locals>.f�	rrI)	rBrMr)rOr!rN�	NameError�UnboundLocalErrorr=rFrr>r�
test_set_cellis"

$z$FunctionPropertiesTest.test_set_cellcCs�|�|jjd�d|j_|�|jjd�d|j_|�|jjd�|�|jddt�d}t|dii�|�|jjjd�|�|jjddt�dS)	NrrG�drr+zdef f(): pass
f.__name__�__builtins__r)	r)rrr'r9�execrrr8)r�srrr�
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)
NrrrrrrrrrGrVrr+)	r)rrrrrrr'r9rrrr�test___qualname__�s&
���z(FunctionPropertiesTest.test___qualname__csd\��dd�}dd�}�fdd�}�fdd	�}��fd
d�}|||||fD]}|�t|j�tj�qL|�|�d�|�|�d
�|j|_|�|j|j�|�|�d�z|j|_Wnty�Yn0|�d�z|j|_Wnty�Yn0|�d�dS)N)r+�cSsdSr	rrrrrr�rz/FunctionPropertiesTest.test___code__.<locals>.acSsdS)Nr;rrrrrr�rz/FunctionPropertiesTest.test___code__.<locals>.bcs�Sr	rr)�num_onerrrG�rz/FunctionPropertiesTest.test___code__.<locals>.ccs�Sr	rr)�num_tworrrV�rz/FunctionPropertiesTest.test___code__.<locals>.dcs��fSr	rr�r]r^rr�e�rz/FunctionPropertiesTest.test___code__.<locals>.er+r\zC__code__ with different numbers of free vars should not be possible)r)�typer2rK�CodeTyperOr!)rrrrGrVr`�funcrr_r�
test___code__�s.
z$FunctionPropertiesTest.test___code__cCs*|�|jjd�|j`|�|jjd�dSr	)r)r�__defaults__rrrr�test_blank_func_defaults�sz/FunctionPropertiesTest.test_blank_func_defaultscCs�dd�}ddd�}|�|jd�|�|jd�d|_|�|jd�|�|�d�|�|d�d	�|�|dd	�d
�|`|�|jd�z
|�Wnty�Yn0|�d�dS)
NcSs||Sr	r�rrrrr�
first_func�szAFunctionPropertiesTest.test_func_default_args.<locals>.first_funcr@r5cSs||Sr	rrgrrr�second_func�szBFunctionPropertiesTest.test_func_default_args.<locals>.second_func)r@r5r�r\zE__defaults__ does not update; deleting it does not remove requirement)r@r5)r)rer9r!)rrhrirrr�test_func_default_args�s 

z-FunctionPropertiesTest.test_func_default_argsN)rrrr*r.r0r3r:rHrPrQrUrZr[rdrfrkrrrrr(,s	
	
r(c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�InstancemethodAttrTestcCs0|�|jjjj|j�|�|jjd|jt�dS)NrE)r)rr�__self__rErr'r9rrrr�test___class__�sz%InstancemethodAttrTest.test___class__cCs2|�|jjj|jj�|�|jjd|jjt�dS)N�__func__)r)rrrorr'r8rrrr�
test___func__�sz$InstancemethodAttrTest.test___func__cCs.|�|jjj|j�|�|jjd|jt�dS)Nrm)r)rrrmr'r8rrrr�
test___self__�sz$InstancemethodAttrTest.test___self__cCsnt�t|j�|j_|�|j��t|j��z|jjjWntyJYn0|�d�|�|jjddt�dS)N�4using unknown attributes should raise AttributeError�unknown_attrr5)	rK�
MethodType�idrr)rsr8r!r'rrrr�test___func___non_method�s
z/InstancemethodAttrTest.test___func___non_methodN)rrrrnrprqrvrrrrrl�srlc@s$eZdZdd�Zdd�Zdd�ZdS)�ArbitraryFunctionAttrTestcCsHd|j_|�|jjd�zd|jj_Wnty8Yn0|�d�dS)Nr+z0setting attributes on methods should raise error)rr,r)rrr8r!rrrr�
test_set_attr�sz'ArbitraryFunctionAttrTest.test_set_attrcCs,z
|j`WntyYn0|�d�dS)Nz1deleting unknown attribute should raise TypeError)rrsr8r!rrrr�test_delete_unknown_attrs

z2ArbitraryFunctionAttrTest.test_delete_unknown_attrc	Cs@|j|jjfD],}z
|jWnty.Yq0|�d�qdS)Nrr)rrrZnon_existent_attrr8r!)rrcrrr�test_unset_attrs
z)ArbitraryFunctionAttrTest.test_unset_attrN)rrrrxryrzrrrrrw�s
rwc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�FunctionDictsTestcCsD|�|jddt�ddlm}|ddi�}|�|jjjd|t�dS)N�__dict__r)�UserDictr,r+)r'rr9�collectionsr}rrro)rr}rVrrr�test_setting_dict_to_invalidsz.FunctionDictsTest.test_setting_dict_to_invalidcCs�ddi}||j_|�||jj�||jj_|�||jjjj�|�||jjj�|�|jjd�|�|jjdd�|�|jjjjd�|�|jjjd�dS)Nr,r+)	rr|r6rrrror)r,)rrVrrr�test_setting_dict_to_valids
z,FunctionDictsTest.test_setting_dict_to_validcCs,z
|j`WntyYn0|�d�dS)Nz3deleting function dictionary should raise TypeError)rr|r9r!rrrr�test_delete___dict__.s

z&FunctionDictsTest.test_delete___dict__cCs|�|jji�dSr	)r)rr|rrrr�test_unassigned_dict6sz&FunctionDictsTest.test_unassigned_dictcCs(d}i}|||j<|�||j|�dS)NzSome string)rr))rr%rVrrr�test_func_as_dict_key9s
z'FunctionDictsTest.test_func_as_dict_keyN)rrrrr�r�r�r�rrrrr{s
r{c@seZdZdd�Zdd�ZdS)�FunctionDocstringTestcCs`|�|jjd�d}||j_||jj_|�|jj|�|�|jjj|�|�|jjd|t�dS)NzA test method that does nothing�__doc__)r)rr�rrrr'r8)rZdocstrrrr�test_set_docstring_attrAs
z-FunctionDocstringTest.test_set_docstring_attrcCs"d|j_|j`|�|jjd�dS)Nz
The docstring)rr�r)rrrr�test_delete_docstringJsz+FunctionDocstringTest.test_delete_docstringN)rrrr�r�rrrrr�@s	r�cs�fdd�}|�|jdS)Ncst��dSr	r<rr>rrr?Rszcell.<locals>.fr�rB)r%r?rr>rrAPsrATcs�fdd�}|sd�|jdS)Ncst��dSr	r<rr>rrr?Yszempty_cell.<locals>.fi�rr�)�emptyr?rr>r�
empty_cellWsr�c@seZdZdd�ZdS)�CellTestcCsj|�td�td�k�|�t�td�k�|�t�t�k�|�td�td�k�|�td�t�k�dS)Nr5rZsaturdayi���gB�T)�
assertTruerAr�rrrr�test_comparisonds
zCellTest.test_comparisonN)rrrr�rrrrr�csr�c@seZdZdd�ZdS)�StaticMethodAttrsTestcCs<dd�}t|�}|�|j|u�t|�}|�|j|u�dS)NcSsdSr	rrrrrr?rsz4StaticMethodAttrsTest.test_func_attribute.<locals>.f)�classmethodr�ro�staticmethod)rr?rGrYrrr�test_func_attributeqs
z)StaticMethodAttrsTest.test_func_attributeN)rrrr�rrrrr�psr�c@seZdZdd�ZdS)�BuiltinFunctionPropertiesTestcCs�ddl}|�tjd�|�|jjd�|�tjjd�|�tjjd�|�tj	jd�|�t
j	jd�|�gd�jjd	�|�d
dijjd�dS)
NrrD�timez
dict.fromkeyszfloat.__getformat__z
str.maketranszbytes.maketrans)r@r5rzlist.appendZfooZbarzdict.pop)
r�r)rDr�dict�fromkeys�float�
__getformat__�str�	maketrans�bytes�append�pop)rr�rrr�test_builtin__qualname__�s
�z6BuiltinFunctionPropertiesTest.test_builtin__qualname__N)rrrr�rrrrr�|sr��__main__)T)rKZunittestrZTestCaserr(rlrwr{r�rAr�r�r�r�r�mainrrrr�<module>s 
0)



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