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-1.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)NcSsdS)zmy docstringrrrrrr�	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__)rr0rrr�test_copying___code__As
z,FunctionPropertiesTest.test_copying___code__cCs,|�|jjt��|�|jddttf�dS)N�__globals__�)�assertIsrr3�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__)	rAZassertIsInstance�tupler(�len�	__class__rr&r7�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_objrIrrr�
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>.frrHr:)rArLrNr )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�	rrH)	rArLr(rNr rM�	NameError�UnboundLocalErrorr<rErr=r�
test_set_cellis"

$z$FunctionPropertiesTest.test_set_cellcCs�|�|jjd�d|j_|�|jjd�d|j_|�|jjd�|�|jddt�d}t|dii�|�|jjjd�|�|jjddt�dS)	NrrF�drr*zdef f(): pass
f.__name__�__builtins__r)	r(rrr&r8�execrrr7)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rrFrUrr*)	r(rrrrrrr&r8rrrr�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_onerrrF�rz/FunctionPropertiesTest.test___code__.<locals>.ccs�Sr	rr)�num_tworrrU�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(�typer1rJ�CodeTyperNr )rrrrFrUr_�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?r4cSs||Sr	rrfrrr�second_func�szBFunctionPropertiesTest.test_func_default_args.<locals>.second_func)r?r4r�r[zE__defaults__ does not update; deleting it does not remove requirement)r?r4)r(rdr8r )rrgrhrrr�test_func_default_args�s 

z-FunctionPropertiesTest.test_func_default_argsN)rrrr)r-r/r2r9rGrOrPrTrYrZrcrerjrrrrr',s	
	
r'c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�InstancemethodAttrTestcCs0|�|jjjj|j�|�|jjd|jt�dS)NrD)r(rr�__self__rDrr&r8rrrr�test___class__�sz%InstancemethodAttrTest.test___class__cCs2|�|jjj|jj�|�|jjd|jjt�dS)N�__func__)r(rrrnrr&r7rrrr�
test___func__�sz$InstancemethodAttrTest.test___func__cCs.|�|jjj|j�|�|jjd|jt�dS)Nrl)r(rrrlr&r7rrrr�
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_attrr4)	rJ�
MethodType�idrr(rrr7r r&rrrr�test___func___non_method�s
z/InstancemethodAttrTest.test___func___non_methodN)rrrrmrorprurrrrrk�srkc@s$eZdZdd�Zdd�Zdd�ZdS)�ArbitraryFunctionAttrTestcCsHd|j_|�|jjd�zd|jj_Wnty8Yn0|�d�dS)Nr*z0setting attributes on methods should raise error)rr+r(rrr7r rrrr�
test_set_attr�sz'ArbitraryFunctionAttrTest.test_set_attrcCs,z
|j`WntyYn0|�d�dS)Nz1deleting unknown attribute should raise TypeError)rrrr7r rrrr�test_delete_unknown_attrs

z2ArbitraryFunctionAttrTest.test_delete_unknown_attrc	Cs@|j|jjfD],}z
|jWnty.Yq0|�d�qdS)Nrq)rrrZnon_existent_attrr7r )rrbrrr�test_unset_attrs
z)ArbitraryFunctionAttrTest.test_unset_attrN)rrrrwrxryrrrrrv�s
rvc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�FunctionDictsTestcCsD|�|jddt�ddlm}|ddi�}|�|jjjd|t�dS)N�__dict__r)�UserDictr+r*)r&rr8�collectionsr|rrrn)rr|rUrrr�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{r5rrrrnr(r+)rrUrrr�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{r8r 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$rUrrr�test_func_as_dict_key9s
z'FunctionDictsTest.test_func_as_dict_keyN)rrrr~rr�r�r�rrrrrzs
rzc@seZdZdd�Zdd�ZdS)�FunctionDocstringTestcCs`|�|jjd�d}||j_||jj_|�|jj|�|�|jjj|�|�|jjd|t�dS)NzA test method that does nothing�__doc__)r(rr�rrrr&r7)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)z)Create a cell containing the given value.cst��dSr	r;rr=rrr>Rszcell.<locals>.fr�rA)r$r>rr=rr@Psr@Tcs�fdd�}|sd�|jdS)zCreate an empty cell.cs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)Nr4rZsaturdayi���gB�T)�
assertTruer@r�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�rn�staticmethod)rr>rFrXrrr�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)
NrrC�timez
dict.fromkeyszfloat.__getformat__z
str.maketranszbytes.maketrans)r?r4rzlist.appendZfooZbarzdict.pop)
r�r(rCr�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)rJZunittestrZTestCaserr'rkrvrzr�r@r�r�r�r�r�mainrrrr�<module>s 
0)



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