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

a

��g!��@sddlmZddlmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZdaGdd�dej�ZGdd�dej�ZGdd	�d	ej�ZejjGd
d�dej��ZejjGdd
�d
ej��Zedk�re��dS)�)�support)�assert_python_ok�assert_python_failureNc@s$eZdZdd�Zdd�Zdd�ZdS)�DisplayHookTestcCs�tj}t���}|d�Wd�n1s,0Y|�|��d�|�tjd�t`t���}|d�Wd�n1s~0Y|�|��d�|�t	td��|�
t|�tj}zt`|�
t
|d�W|t_n|t_0dS)N�*z42
��_)�sys�__displayhook__rZcaptured_stdout�assertEqual�getvalue�builtinsr�
assertTrue�hasattr�assertRaises�	TypeError�stdout�RuntimeError)�selfZdh�outr�r�)/usr/local/lib/python3.9/test/test_sys.py�test_original_displayhooks 
&
&z)DisplayHookTest.test_original_displayhookcCs<tj}z(t`tddd�}|�tt|�W|t_n|t_0dS)N�42�<string>�single)r	�displayhook�compilerr�eval)rr�coderrr�test_lost_displayhook5sz%DisplayHookTest.test_lost_displayhookcCsTdd�}t�td|��*tddd�}|�tt|�Wd�n1sF0YdS)NcSst�dS�N��
ValueError)�objrrr�baddisplayhook?sz?DisplayHookTest.test_custom_displayhook.<locals>.baddisplayhookrrrr)r�	swap_attrr	rrr#r)rr%rrrr�test_custom_displayhook>sz'DisplayHookTest.test_custom_displayhookN)�__name__�
__module__�__qualname__rr r'rrrrrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�ExceptHookTestcCs�ztd��WnZtyf}zBt���}tjt���Wd�n1sH0YWYd}~n
d}~00|�|���d��|�	t
tj�dS)Nr�ValueError: 42
)r#r�captured_stderrr	�__excepthook__�exc_inforr�endswithrr�r�exc�errrrr�test_original_excepthookIs
Bz'ExceptHookTest.test_original_excepthookcCs�t����t�dt�ztdd��WnZty~}zBt���}tjt�	��Wd�n1s`0YWYd}~n
d}~00Wd�n1s�0Y|�
�}|�d|�|�d|�|�|�
d��dS)N�ignore�msg)sbytes_filename�{r�textz%  File "b'bytes_filename'", line 123
z	    text
zSyntaxError: msg
)�warnings�catch_warnings�simplefilter�BytesWarning�SyntaxErrorrr-r	r.r/r�assertInrr0r1rrr�test_excepthook_bytes_filenameTs

`z-ExceptHookTest.test_excepthook_bytes_filenamecCsPtj�d��}t�ddd�Wd�n1s00Y|�d|��v�dS)N�stderr��1zETypeError: print_exception(): Exception expected for value, str found)�testr�captured_outputr	�
excepthookrr)rr@rrr�test_excepthookes
,�zExceptHookTest.test_excepthookN)r(r)r*r4r?rFrrrrr+Gsr+c@seZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	j
jd
d��Zdd�Z
dd�Ze�eed�d�dd��Ze	j
jdd��Zdd�Ze	j
jdd��Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z d-d.�Z!e	j
jd/d0��Z"d1d2�Z#e�e	j
j$d3�e�e�%�e&�'d4�kd5�d6d7���Z(e�)ej*ej+kd8�d9d:��Z,dbd<d=�Z-d>d?�Z.dcd@dA�Z/dBdC�Z0dDdE�Z1dFdG�Z2dHdI�Z3e	j
jdJdK��Z4e�eedL�dM�dNdO��Z5dPdQ�Z6dRdS�Z7dTdU�Z8e�eedV�dW�dXdY��Z9dZd[�Z:d\d]�Z;e�eed^�d_�d`da��Z<d;S)d�
SysModuleTestcCstj��dSr!)rCr�
reap_children�rrrr�tearDownqszSysModuleTest.tearDowncs��ttjdd���t��}t��Wd�n1s:0Y��|jj�tdd�\}}}��	|d���	|d���	|d���t��}t�d�Wd�n1s�0Y��	|jjd���t��}t�d�Wd�n1s�0Y��	|jjd���t��}t�d�Wd�n1�s:0Y��	|jjd���t��}t�d�Wd�n1�s�0Y��	|jjd�t
dd	�\}}}��	|d
���	|d���	|d��fdd�}|d
d�|dd�|dddd�dS)Nr�-czimport sys; sys.exit()r�)r�exit)��zraise SystemExit(47)�/csVtd|fi|��\}}}��|d���|d���|�|�dt|�t|�f�dS)NrKrArLz%s doesn't start with %s)rrr�
startswith�ascii)r�expectedZenv_vars�rcrr3rIrr�check_exit_message�s�z3SysModuleTest.test_exit.<locals>.check_exit_messagez?import sys; sys.stderr.write("unflushed,"); sys.exit("message")sunflushed,messagez)import sys; sys.exit("surrogates:\uDCFF")ssurrogates:\udcffzimport sys; sys.exit("h\xe9")sh�zlatin-1)�PYTHONIOENCODING)rrr	rM�
SystemExit�assertIsNone�	exceptionrrrr)r�cmrTrr3rUrrIr�	test_exittsJ&((**	���zSysModuleTest.test_exitcCs$|�ttjd�|�t��t�dS)Nr)rrr	�getdefaultencoding�assertIsInstance�strrIrrr�test_getdefaultencoding�sz%SysModuleTest.test_getdefaultencodingc	Cs�|�ttj�|�ttjd�|�ttjd�|�ttjd�t��}|�|dk|�z:ddd|fD]}t�|�|�t��|�qdWt�|�nt�|�0dS)N�ag�gg�?g�h㈵��>g�������?g@)rrr	�setswitchintervalr#�getswitchintervalrZassertAlmostEqual)rZorig�nrrr�test_switchinterval�s
z!SysModuleTest.test_switchintervalcCs^|�ttjd�t��}|�ttj�|�ttjd�t�d�|�t��d�t�|�dS)Nri���i')rrr	�getrecursionlimit�setrecursionlimitr#r)r�oldlimitrrr�test_recursionlimit�s
z!SysModuleTest.test_recursionlimitc	s�ttd�rt��r|�d�t��}�fdd��zVdD]B}zt�|�Wnty^Yq6Yn0|�t��|�t��q6Wt�|�nt�|�0dS)N�gettracez(fatal error if run with a trace functioncs
��dSr!rr��frrrk�sz5SysModuleTest.test_recursionlimit_recovery.<locals>.f)�
��2�K�d���)rr	riZskipTestrerf�RecursionErrorr)rrg�depthrrjr�test_recursionlimit_recovery�s

z*SysModuleTest.test_recursionlimit_recoveryc	sbddlm����fdd��t��}z,t�d�dD]}�||�q4Wt�|�nt�|�0dS)Nr)�get_recursion_depthcsd��}||krV��t��}t�|�Wd�n1s80Y��t|j�d�n
�||�dS)Nz\cannot set the recursion limit to [0-9]+ at the recursion depth [0-9]+: the limit is too low)rrsr	rfZassertRegexr^rY)rt�limit�recursion_depthrZ�rvr�set_recursion_limit_at_depthrrrz�s(�zZSysModuleTest.test_setrecursionlimit_recursion_depth.<locals>.set_recursion_limit_at_depthrr)rlrmrnrorp���)�_testinternalcapirvr	rerf)rrgrwrryr�&test_setrecursionlimit_recursion_depth�s
z4SysModuleTest.test_setrecursionlimit_recursion_depthcCsvtj�td�t��}|�t|�d�|�|dt�|�|dt�|�|dt�|�|dt�|�|dt	�|�
ttj
|d�|�|jt�|�|jt�|�|jt�|�|jt�|�|jt	�|�|jt�|�|jt�|�|jt�|�|jt�|�|d|j�|�|d|j�|�|d|j�|�|d|j�|�|d|j�t��\}}}}}dS)N�getwindowsversion�rrA���)rCr�
get_attributer	rr�lenr]�intr^r�
IndexError�operator�getitem�major�minorZbuild�platformZservice_packZservice_pack_minorZservice_pack_majorZ
suite_maskZproduct_type)r�vZmaj�minZbuildnoZplatZcsdrrr�test_getwindowsversions0z$SysModuleTest.test_getwindowsversioncCs|�ttjtd�dS)Nr�)rrr	�call_tracing�typerIrrr�test_call_tracing)szSysModuleTest.test_call_tracing�setdlopenflagsztest needs sys.setdlopenflags()cCsf|�ttd��|�ttjd�t��}|�ttj�t�|d�|�t��|d�t�|�dS)N�getdlopenflagsrrA)rrr	rrr�r�r)rZoldflagsrrr�test_dlopenflags,szSysModuleTest.test_dlopenflagscCsd|�ttj�t�d�}da|�t�d�|d�b|�t�d�|�ttd�r`|�t��t	�dS)NrA�gettotalrefcount)
rrr	�getrefcountrcrrr]r�r�)r�crrr�
test_refcount7s

zSysModuleTest.test_refcountcCs>|�ttjdd�|�ttjd�|�tjjt��j	u�dS)Nri�5w)
rrr	�	_getframer#rrG�
test_getframe�__code__�f_coderIrrrr�Gs��zSysModuleTest.test_getframecsrddl�ddl}��������g��fdd�}����fdd���j|d�}|�����|�t��d��d}t�	�}|D]}|�
|t�|�|d�q���
�}|�||�|�||�|�|�}|�|t��u�|�|�}|�|�}	t|	�D]\}
\}}}
}|
dkr��q"q�|�d	�|�|d
�|	|
d\}}}
}|�|
d�|�|dd
g����|��dS)Nrcs
��dSr!rr)�g456rr�f123\sz/SysModuleTest.test_current_frames.<locals>.f123cs"������������dSr!)�append�	get_ident�set�waitr)�	entered_g�leave_g�thread_info�	threadingrrr�_sz/SysModuleTest.test_current_frames.<locals>.g456)�targetrAr�z)didn't find f123() on thread's call stackzg456()r�zleave_g.wait()zentered_g.set())r��	traceback�Event�Thread�startr�rr�r	�_current_framesr]r��
assertGreaterr�r>�poprr��
extract_stack�	enumerateZfailr��join)rr�r��tZ	thread_id�d�tidZmain_id�frame�stack�i�filename�lineno�funcnameZ
sourceliner)r�r�r�r�r�r�test_current_framesPsB



z!SysModuleTest.test_current_framescCs||�tjt�|�tjt�|�tjd�|�tjt	�|�tj
t�|�tjt�|�tj
t�|�tjt�|�ttj�d�|�tjjd�|�ttj�d�|�tjjddk�|�tjjdk�|�tjjd�|�tjjd	�|�tjjtjj�|�ttjj�t�|�ttjj�t�|�tjjt�|�tjjt�|�tjt�|�ttj�d
�|�tjjdtjj �t!dd	�D]2}|�t"|tjjdtjj�dd�#tjj���q�|�tjj$t�|�tjj%t�|�tjj&t�t'�(d�}tjj)d
v�r||�tjj*ddh�|�tjj+hd��|dk�rJ|�tjj)d�n0|dk�rf|�tjj)d�n|�tjj)ddh�n|�|d�|�tjj,d�|�tjj,d�|�tj-t�|�tj.t�|�tj.d�|�tj/t�|�tj0t�|�tj1t�|�tj2t�|�tj3t�tj4}|�|dd�t	�|�t|�d�|�|dt�|�|dt�|�|dt�|�|dd�|�|dt�|�|j5t�|�|j6t�|�|j7t�|�|j8d�|�|j9t�|�|d|j5�|�|d|j6�|�|d|j7�|�|d|j8�|�|d|j9�|�|dk�|�tj:t�|�tj:d�tj/�;d��sx|�tj<t�dS)N)�little�big�r�r�r�rrAi�rp�	z'sys.hash_info.modulus {} is a non-primeZPy_HASH_ALGORITHM>�	siphash24�fnv� �@>r�r��r�r��i��r���alpha�beta�	candidate�final)rArr)Zshort�legacy�win)=r]r	�api_versionr��argv�listr>�	byteorder�builtin_module_names�tuple�	copyrightr^�exec_prefix�base_exec_prefix�
executablerr��
float_info�radix�int_infor�bits_per_digit�sizeof_digit�assertGreaterEqual�default_max_str_digits�str_digits_check_thresholdr�r��
hexversion�	hash_info�
assertLess�modulus�width�range�pow�format�inf�nan�imag�	sysconfigZget_config_var�	algorithm�	hash_bits�	seed_bits�cutoff�maxsize�
maxunicoder��prefix�base_prefix�
platlibdir�version�version_infor�r��micro�releaselevel�serial�float_repr_stylerQ�abiflags)r�xZalgo�virrr�test_attributes�s�
���


zSysModuleTest.test_attributescCs6tj}|�t|�d�|�|jd�|�|jd�dS)Nr�)�ntZpthreadZsolarisN)�	semaphorez
mutex+condN)r	r�rr�r>�name�lock)r�inforrr�test_thread_info�szSysModuleTest.test_thread_infocCs|�tjjtjj�dSr!)rr	�
__stdout__�encoding�
__stderr__rIrrr�
test_43581�szSysModuleTest.test_43581cCs~td7a|�ttj�dtt�}|�t�|�|u�|����}|�t�|�|u�Gdd�dt�}|�ttj|d��dS)NrAznever interned beforec@seZdZdd�ZdS)z$SysModuleTest.test_intern.<locals>.ScSsdS)Nr7rrIrrr�__hash__sz-SysModuleTest.test_intern.<locals>.S.__hash__N)r(r)r*r	rrrr�Ssr
�abc)�INTERN_NUMRUNSrrr	�internr^r�swapcase)r�s�s2r
rrr�test_intern�szSysModuleTest.test_interncCs�|�tj�d}|D]B}|�ttj|�|�|dkr8tnt}|�tttj|��||�q|�t	tj��|�t
tj�t
|��|�tjjhd��dS)N)�debug�inspect�interactive�optimize�dont_write_bytecode�no_user_site�no_site�ignore_environment�verbose�
bytes_warning�quiet�hash_randomization�isolated�dev_mode�	utf8_mode�int_max_str_digitsr>rrAr�)
rr	�flagsr�boolr�rr��getattr�reprr�r>r )r�attrs�attr�	attr_typerrr�test_sys_flagsszSysModuleTest.test_sys_flagscCspt|�}|�t��|�Wd�n1s.0Y|�t��|�|�Wd�n1sb0YdSr!)r�rr�__new__)rZsys_attrr(rrr�assert_raise_on_new_sys_types
$z*SysModuleTest.assert_raise_on_new_sys_typecCs|�tj�dSr!)r+r	r"rIrrr�test_sys_flags_no_instantiation"sz-SysModuleTest.test_sys_flags_no_instantiationcCs|�tj�dSr!)r+r	r�rIrrr�&test_sys_version_info_no_instantiation%sz4SysModuleTest.test_sys_version_info_no_instantiationcCs tj�td�|�t���dS)Nr)rCrr�r	r+rrIrrr�+test_sys_getwindowsversion_no_instantiation(sz9SysModuleTest.test_sys_getwindowsversion_no_instantiationcCst��dSr!)r	�_clear_type_cacherIrrr�test_clear_type_cache-sz#SysModuleTest.test_clear_type_cachecCs�ttj�}d|d<tjtjddgtj|d�}|��d�	�}dtj
�d�}|�||�d|d<tjtjddgtj|d�}|��d�	�}|�|d	�d
|d<tjtjddgtjtj|d�}|��\}}|�|d�|�
d
|�|�
d|�d|d<tjtjddgtjtj|d�}|��\}}|�|d�|�
d
|�|�
d|�d|d<tjtjddgtj|d�}|��d�	�}|�|d�dS)N�cp424rVrKzprint(chr(0xa2))�r�envr�¢z
ascii:replace�?rR)rr@r3rLsUnicodeEncodeError:s'\xa2'zascii:z:surrogateescapezprint(chr(0xdcbd))��)�dict�os�environ�
subprocess�Popenr	r��PIPE�communicate�strip�linesep�encoderr>)rr3�prrSr3rrr�test_ioencoding1sL
�����zSysModuleTest.test_ioencodingz*requires OS support of non-ASCII encodingsFz$requires FS encoding to match localecCs^ttj�}d|d<tjtjddtjj	gtj
|d�}|��d��}|�
|t�tjj	��dS)NrrVrKz	print(%a)r2r)r7r8r9r:r;r	r�rCr�FS_NONASCIIr<r=r>r�fsencode)rr3rArrrr�test_ioencoding_nonascii\s


��z&SysModuleTest.test_ioencoding_nonasciizTest is not venv-compatiblec	Cs�|�tj�tj�tj�tj�tj�tj��}tj	gd�tjtj
|d�}|��d}|���
d�}|��|�|dttj�dd��g�dS)N)ZnonexistentrKzEimport sys; print(sys.executable.encode("ascii", "backslashreplace")))r�r�cwdr�ASCIIzb''rR�backslashreplace)rr8�path�abspathr	r��dirname�realpathr:r;r<r=r>�decoder�r>r%r@)rZ
python_dirrArr�rrr�test_executablejs
�zSysModuleTest.test_executableNcCs(|�|�t�|�|r$|�||�dSr!)ZassertIsNotNone�codecs�lookupr�rZfs_encodingrSrrr�check_fsencoding�s

zSysModuleTest.check_fsencodingcCs,t��}tjdkrd}nd}|�||�dS)N�darwinzutf-8)r	�getfilesystemencodingr�rRrQrrr�test_getfilesystemencoding�s

z(SysModuleTest.test_getfilesystemencodingc
Cs�tj��}||d<d|d<d�d�}tjddd|g}|rB|�d	�|durT||d
<n|�d
d�tj	|tj
tj|dd�}|��\}}	|S)
N�LC_ALL�0ZPYTHONCOERCECLOCALE�
)�
import syszdef dump(name):z    std = getattr(sys, name)z(    print("%s: %s" % (name, std.errors))z
dump("stdin")zdump("stdout")zdump("stderr")z-Xzutf8=0rKz-IrVT)rr@r3�universal_newlines)
r8r9�copyr�r	r�r�r�r:r;r<�STDOUTr=)
r�localerrr3r�argsrArr@rrr�c_locale_get_error_handler�s$

	

�z(SysModuleTest.c_locale_get_error_handlercCs�|j|dd�}|�|d�|j|dd�}|�|d�|j|dd�}|�|d�|j|d	d�}|�|d�|j|d
d�}|�|d�|j|dd�}|�|d�dS)NT)rzHstdin: surrogateescape
stdout: surrogateescape
stderr: backslashreplace
z:ignore)rz6stdin: ignore
stdout: ignore
stderr: backslashreplace
z	iso8859-1z6stdin: strict
stdout: strict
stderr: backslashreplace
z
iso8859-1:�:r)r_r)rr]rrrr�check_locale_surrogateescape�s0������z*SysModuleTest.check_locale_surrogateescapecCs|�d�dS)N�C�rarIrrr�test_c_locale_surrogateescape�sz+SysModuleTest.test_c_locale_surrogateescapecCs|�d�dS)NZPOSIXrcrIrrr�!test_posix_locale_surrogateescape�sz/SysModuleTest.test_posix_locale_surrogateescapecCs�ddddd�}|�ttjd��|�ttjd��|�ttjd��|�ttjd	��tjj}|�|dd
�|j|jf�|jd>|jd>B|jd
>B||j	d>B|j
d>B}|�tjj|�|�tjjtjj�
��dS)Nrlr���r�rr�r��	cache_tagr���r�r�r)rrr	�implementationr�rr�r�r�r�r�r�r�lower)rZlevelsr�r�rrr�test_implementation�s$���

�z!SysModuleTest.test_implementationcCsBddlm}ddg}||�\}}}|�d|�|�ttjd�dS)Nr)rrKz#import sys; sys._debugmallocstats()sfree PyDictObjectsT)�test.support.script_helperrr>rrr	�_debugmallocstats)rrr^�retrr3rrr�test_debugmallocstats�s
z#SysModuleTest.test_debugmallocstats�getallocatedblocksz0sys.getallocatedblocks unavailable on this buildc
Cszddl}Wnty&t��}Yn@0z|��}Wn(ty\}zd}WYd}~nd}~00|dv}t��}|�t	|�t
�|r�|�|d�n|�|d�z|�
|t���Wnty�Yn0t��t��}|�||�t��t��}|�|t|d|d��dS)NrT)ZpymallocZpymalloc_debugrn)�	_testcapi�ImportErrorr�
with_pymallocZpymem_getallocatorsnamerr	rr�assertIsr�r�r�r�r�r��AttributeError�gcZcollectZassertLessEqualr>r�)rrsruZ
alloc_namer2r`�br�rrr�test_getallocatedblocks�s0z%SysModuleTest.test_getallocatedblockscCs8|�t��d�d}td|�\}}}|�|��d�dS)NFa�if 1:
            import sys

            class AtExit:
                is_finalizing = sys.is_finalizing
                print = print

                def __del__(self):
                    self.print(self.is_finalizing(), flush=True)

            # Keep a reference in the __main__ module namespace, so the
            # AtExit destructor will be called at Python exit
            ref = AtExit()
        rKsTrue)rvr	�
is_finalizingrr�rstrip�rrrTrr@rrr�test_is_finalizing!sz SysModuleTest.test_is_finalizingcCs@d}td|�\}}}|��}|�d|d�|�d|d�dS)Nz�if 1:
            import sys
            class A:
                def __del__(self, sys=sys):
                    print(sys.flags)
                    print(sys.float_info)
            a = A()
            rKs	sys.flagsrssys.float_inforA)r�
splitlinesr>�rrrTrr3rrr�test_issue206026s
zSysModuleTest.test_issue20602cCsDd}td|�\}}}|�|d�|�|��d�|�|��d�dS)Nz�if 1:
            import struct, sys

            class C:
                def __init__(self):
                    self.pack = struct.pack
                def __del__(self):
                    self.pack('I', -42)

            sys.x = C()
            rKrrL)rrr|r}rrr�&test_sys_ignores_cleaning_up_user_dataEs
z4SysModuleTest.test_sys_ignores_cleaning_up_user_data�getandroidapilevelzneed sys.getandroidapilevel()cCs$t��}|�|t�|�|d�dS)Nr)r	r�r]r�r�)r�levelrrr�test_getandroidapilevelVsz%SysModuleTest.test_getandroidapilevelcs�d���fdd�}gd�}|d|�|d|�|d|dd�|dd��|d|dd�|dd��|d	|d
g�|d
|d
g�|dd>|�|d
d>|d
g�|d|�dS)Nz�if 1:
            import sys
            def f1():
                1 / 0
            def f2():
                f1()
            sys.tracebacklimit = %r
            f2()
        cs<tjtjd�|gtjd�}|��d}��|��|�dS)NrK)r@rA)r:r;r	r�r<r=rr)�tracebacklimitrSrAr�rrrr�checkgs
�z4SysModuleTest.test_sys_tracebacklimit.<locals>.check)s"Traceback (most recent call last):s&  File "<string>", line 8, in <module>s   File "<string>", line 6, in f2s   File "<string>", line 4, in f1s#ZeroDivisionError: division by zerorlr�r�rAr���rrr)rr�r�rr�r�test_sys_tracebacklimit]s	

z%SysModuleTest.test_sys_tracebacklimitcCs |�ttj�tttj���dSr!)rr�r	�	meta_pathr�rIrrr�test_no_duplicates_in_meta_path~sz-SysModuleTest.test_no_duplicates_in_meta_pathZ_enablelegacywindowsfsencodingz*needs sys._enablelegacywindowsfsencoding()cCs:d}tdd�|��\}}}|�dd���}|�|d�dS)N)rYz$sys._enablelegacywindowsfsencoding()zCprint(sys.getfilesystemencoding(), sys.getfilesystemencodeerrors())rKz; rR�replacezmbcs replace)rr�rMr|rr�rrr�#test__enablelegacywindowsfsencoding�sz1SysModuleTest.test__enablelegacywindowsfsencoding)N)FN)=r(r)r*rJr[r_rdrhrurCr�cpython_onlyr~r�r��unittestZ
skipUnlessrr	r�Z
refcount_testr�r�Zreap_threadsr�r�rrrr)r+r,r-r.r0rBrCrTr]�getpreferredencodingrEZskipIfr�r�rNrRrUr_rardrermrqrzr~r�r�r�r�r�r�rrrrrGos�B	
�
	
	
@X	
+
��
�


&

�
'�
!�rGc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�UnraisableHookTestcCsTddl}ddl}d|��}z.|�|||�|jt|�||j||d�Wd}Sd}0dS)Nr�Exception ignored )�exc_type�	exc_value�
exc_traceback�err_msg�object)rs�types�write_unraisable_exc�SimpleNamespacer��
__traceback__)rr2r�r$rsr�Zerr_msg2rrrr��s

��z'UnraisableHookTest.write_unraisable_exccCsdD]�}|j|d���d}tj�d��T}tj�tdtj��"|�td�||�Wd�n1sb0YWd�n1s�0Y|�	�}|dur�|�
d|�d|�d	�|�n|�
d
|�d	�|�|�
d|�|�
d|�Wd�q1s�0YqdS)
N)Nz
original hook)r�z	an objectr@�unraisablehookrr�z: rXzException ignored in: �#Traceback (most recent call last):
r,)�subTestrCrrDr&r	�__unraisablehook__r�r#rr>)rr�r$r@r3rrr�test_original_unraisablehook�s
�Nz/UnraisableHookTest.test_original_unraisablehookcs\Gdd�d�}Gdd�dt��G�fdd�d�}||fD�]}|�|���|�}tj���D}tj�tdtj��~Wd�n1s�0YWd�n1s�0Y|��}|�	d|�|�	|j
j|�|�	d	|�|�	d
|�||u�r|�	d|�|�	d|�n|�	d|�|�	d
|�|�|�
d��Wd�q81�sL0Yq8dS)Nc@seZdZdd�ZdS)zFUnraisableHookTest.test_original_unraisablehook_err.<locals>.BrokenDelcSstd�}|�dS)N�
del is brokenr"�rr2rrr�__del__�szNUnraisableHookTest.test_original_unraisablehook_err.<locals>.BrokenDel.__del__N�r(r)r*r�rrrr�	BrokenDel�sr�c@seZdZdd�ZdS)zOUnraisableHookTest.test_original_unraisablehook_err.<locals>.BrokenStrExceptioncSstd��dS)Nzstr() is broken��	ExceptionrIrrr�__str__�szWUnraisableHookTest.test_original_unraisablehook_err.<locals>.BrokenStrException.__str__N)r(r)r*r�rrrr�BrokenStrException�sr�cseZdZ�fdd�ZdS)zOUnraisableHookTest.test_original_unraisablehook_err.<locals>.BrokenExceptionDelcs��}|�dSr!rr��r�rrr��szWUnraisableHookTest.test_original_unraisablehook_err.<locals>.BrokenExceptionDel.__del__Nr�rr�rr�BrokenExceptionDel�sr�r�zException ignoredztest_sys.pyz	raise excz<exception str() failed>r#r�rX)r�r�rCrr-r&r	r�rr>r�r*rr0)rr�r�Z
test_classr$r@�reportrr�r� test_original_unraisablehook_err�s.
��>
z3UnraisableHookTest.test_original_unraisablehook_errc	Cs�Gdd�d�}tj���V}tj�tdtj��$|�|j��dd�}Wd�n1sV0YWd�n1st0Y|�	�}d}|�
|�d�|�dS)Nc@seZdZGdd�d�ZdS)zMUnraisableHookTest.test_original_unraisablehook_exception_qualname.<locals>.Ac@seZdZGdd�de�ZdS)zOUnraisableHookTest.test_original_unraisablehook_exception_qualname.<locals>.A.Bc@seZdZdS)zQUnraisableHookTest.test_original_unraisablehook_exception_qualname.<locals>.A.B.XN�r(r)r*rrrr�X�sr�N)r(r)r*r�r�rrrr�B�sr�N)r(r)r*r�rrrr�A�sr�r�r6r$�/test_original_unraisablehook_exception_qualnamez.<locals>.A.B.X)rCrr-r&r	r�r�r�r�rr>)rr�r@rSr�ZtestNamerrrr��s
���@zBUnraisableHookTest.test_original_unraisablehook_exception_qualnamec	Csrtd�}tj�tdtj��D|�t��t�|�Wd�n1sF0YWd�n1sd0YdS)Nrr�)	r#rCrr&r	r�rrr�r�rrr�'test_original_unraisablehook_wrong_type�s
�z:UnraisableHookTest.test_original_unraisablehook_wrong_typecs�d��fdd�}t�}zztj�td|��N|�td�d|�}d��D]"}|�t	�|�t	||��|f�qDWd�n1s|0YWd}d�n
d}d�0dS)Ncs|�dSr!r�r^�Z	hook_argsrr�	hook_func�sz@UnraisableHookTest.test_custom_unraisablehook.<locals>.hook_funcr�rzcustom hookz/exc_type exc_value exc_traceback err_msg object)
r�rCrr&r	r�r#�splitrr$)rr�r$rSr'rr�r�test_custom_unraisablehook�s"
��&�z-UnraisableHookTest.test_custom_unraisablehookc	Cs�dd�}tj�d��R}tj�td|��"|�td�dd�Wd�n1sN0YWd�n1sl0Y|��}|�d|�d�|�|�d	|�|�d
|�dS)NcWstd��dS)Nzhook_func failedr�r�rrrr�szEUnraisableHookTest.test_custom_unraisablehook_fail.<locals>.hook_funcr@r�rzcustom hook failz)Exception ignored in sys.unraisablehook: rXr�zException: hook_func failed
)	rCrrDr&r	r�r#rr>)rr�r@r3rrr�test_custom_unraisablehook_fails
�@��z2UnraisableHookTest.test_custom_unraisablehook_failN)
r(r)r*r�r�r�r�r�r�r�rrrrr��s(r�csleZdZdd�ZejjZdd�Zdd�Zdd�Z	�fd	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Z�ZS)�
SizeofTestcCs*t�d�|_tjj|_ddl}|j|_	dS)N�Pr)
�struct�calcsizer�r	r�r��	longdigitr}ZSIZEOF_PYGC_HEAD�gc_headsize)rr}rrr�setUps
zSizeofTest.setUpcCsHtjj}|j}|�t�d�|d�|j�|�t�g�|d�|�dS)NTr�Pn)rCr�calcvobjsizer�rr	�	getsizeofr�)r�vsizeZgc_header_sizerrr�test_gc_head_sizeszSizeofTest.test_gc_head_sizecCs�Gdd�d�}|�ttj|��Gdd�d�}|�ttj|��dg}|�t�|�|�|�Gdd�d�}|�ttj|��|�t�|�|�|�Gdd	�d	t�}|�t�|tj��tj|j	�|�t
��$t�|tjd
��Wd�n1s�0Y|�t��t�|d��Wd�n1�s00Y|�tt
f��&t�|tjd
��Wd�n1�sv0YdS)Nc@seZdZdd�ZdS)z)SizeofTest.test_errors.<locals>.BadSizeofcSst�dSr!r"rIrrr�
__sizeof__)sz4SizeofTest.test_errors.<locals>.BadSizeof.__sizeof__N�r(r)r*r�rrrr�	BadSizeof(sr�c@seZdZdd�ZdS)z-SizeofTest.test_errors.<locals>.InvalidSizeofcSsdSr!rrIrrrr�.sz8SizeofTest.test_errors.<locals>.InvalidSizeof.__sizeof__Nr�rrrr�
InvalidSizeof-sr��sentinelc@seZdZdd�ZdS)z+SizeofTest.test_errors.<locals>.FloatSizeofcSsdS)Ng@rrIrrrr�5sz6SizeofTest.test_errors.<locals>.FloatSizeof.__sizeof__Nr�rrrr�FloatSizeof4sr�c@seZdZdd�ZdS)z.SizeofTest.test_errors.<locals>.OverflowSizeofcSst|�Sr!)r�rIrrrr�;sz9SizeofTest.test_errors.<locals>.OverflowSizeof.__sizeof__Nr�rrrr�OverflowSizeof:sr�rAr�)rr#r	r�rrvr�rr�r��
OverflowError)rr�r�r�r�r�rrr�test_errors's&
�2.zSizeofTest.test_errorscCsFtjj}|�t�d�|d�|j�|�t�dd�|d�|j�dS)NTrr�)rCrr�rr	r�r�)r�sizerrr�test_defaultFszSizeofTest.test_defaultc'	sJ	tj}tjj�tjj}�j��d|d��j��t�d��dddg}|D]"}t	|�}�||d�|�
��qN�tt	���d���d|d	�d
��d|d	�d�d
d�}�|�jd�d���fdd�}||�j
�d��||j
�d��dd�}||j
�d�|d	���tdd
��d���tj�d��ddl}	�|	jj�d��ddl}
�|
jj�d���tj�d���ij�d���i�d���dd
i�d�|d�dd|d ��d
d!d"d#dd$d%dd&�}�|�d�|d�d'd(|d ���i���d���i���d���i���d���ti��d)���ti����d)���ti����d)���ti����d)��Gd*d+�d+t�}�|j�d���t��d,���t ddddd��d-���t!ddddd��d-���t"ddd
d��d-���t#�d��ddl$}
ddl%}|
�&|j'j(�}�|�d.���t)g��d/���t*d��d���t+d��d0���t,j-|d��j.tt,j-��ddl/}d1}|�0�}t|j1j2�}t|j1j3�}|j1j4|j1j5||d
}�||d2|d3d|d��d4d5�}�|�d6��G��fd7d8�d8�}d9d:�}�|��d;���td<��d=��ddl6}�|�7dd��d��ggd>�gd?�g}|D]&}�t8|�|d@�t|��j.��q��tg��d=���t*g��d���d|d���d
|d��j��dA|d��j�d!t,j9j:}�t|�|d�d!�j��t|d!d
�|d�d!�j��t|d!�|d�d"�j��t;�dB���d�d���t<�d���t��d��G��fdCd+�d+t�}�tt=d
���dD���t*d��d���t=d
��dE���t=dF��dE��d}gt=d(�t=dG�g}�dH|ddI�}|D]�}t|�}|dk�r\d
}|d!}|}||k�r~|d
>}�qh|dk�r��t>|�|��t?|�|�n4�t>|�|||d���t?|�|||d���qB�tt>���dJ���t@d��dK���tAt��dK���dL|d���d>|d�d"�j.�dM}||�}�t|�||dN�}GdOdP�dPt�}�|||dQ�dd|d ���|�j�d�d�j.�|�} d
| _B| _C| _D| _E| _F| _G| _H| _I�|||dQ�d'd(|d ���|�j�d�d(�j.�gdR�}dS}!|!dT}"|"d}#|D]�}tJtK|��}$|$dUk�rp�|!�t|�d
}%n\|$dVk�r��|"�t|�d
}%n<|$dWk�r��|"�d!t|�d
}%n�|"�d#t|�d
}%�||%��q@tLdX�}�|�|"�d#�tM|dYdZ��|�|"�d#d#�ddlN}&�|&�Ot��d[���|&�Pt��d[��dS)\NTrZ5PrL�ui��Zn2PiZnPrcrAs
xxxxxxxxxxr�csd��fdd�}|S)Nrcs�Sr!rr�r�rr�innerdsz<SizeofTest.test_objecttypes.<locals>.get_cell.<locals>.innerr)r�rr�r�get_cellbsz-SizeofTest.test_objecttypes.<locals>.get_cellrr�cs��t�|�|�dSr!)r�r	r�)r`Z
expected_sizerIrr�check_code_sizeisz4SizeofTest.test_objecttypes.<locals>.check_code_sizeZ6i13Pcs�fdd�}|S)Ncs�Sr!rrr�rrr�nsz=SizeofTest.test_objecttypes.<locals>.get_cell2.<locals>.innerr)r�r�rr�r�	get_cell2msz.SizeofTest.test_objecttypes.<locals>.get_cell2Z2dZ3PPPZ3PPZ3P2PZ2PZnQ2Pr`Z2nP2nr�r�Zn2Pr�r�r���)rAr�r�r�r�r�r�r�rjrlZP2nPnc@seZdZdS)�&SizeofTest.test_objecttypes.<locals>.CNr�rrrrrb�rLrbZ5Pbz	5Pb 2P2nPZ32B2iBZn3Pr��Z	5P2c4P3icZ3icSsdSr!rrrrr�func�rLz)SizeofTest.test_objecttypes.<locals>.funcZ13Pcs@eZdZedd��Zedd��Z�e�d���e�d��dS)z&SizeofTest.test_objecttypes.<locals>.ccSsdSr!rrrrr�foo�sz*SizeofTest.test_objecttypes.<locals>.c.foocSsdSr!r)�clsrrr�bar�sz*SizeofTest.test_objecttypes.<locals>.c.barZPPN)r(r)r*�staticmethodr��classmethodr�r�r�r�rrr��s

r�css
dVdS)NrArrrrr�get_gen�rLz,SizeofTest.test_objecttypes.<locals>.get_genZPb2PPP4PrZlP)rAr�r�)rB�2�3r�r�ZPnPPPcs@eZdZdd�Zdd�Zdd�Zeeeed�Z�e�d��d	S)
r�cSs|jSr!�Z_C__xrIrrr�getx�rLz+SizeofTest.test_objecttypes.<locals>.C.getxcSs
||_dSr!r�)r�valuerrr�setx�rLz+SizeofTest.test_objecttypes.<locals>.C.setxcSs|`dSr!r�rIrrr�delx�rLz+SizeofTest.test_objecttypes.<locals>.C.delxrZ4PiN)r(r)r*r�r�r��propertyr�rr�rrrb�s
Z4lZ4Pi�rnZ3nPZ2nPZP3n�3PrZP2nPI13Pl4Pn9Pn11PIPPZ3P36P3P10P2P5Pc@seZdZdS)z2SizeofTest.test_objecttypes.<locals>.newstyleclassNr�rrrr�
newstyleclass$rLr�Z2nP2n0P)Zd1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111udÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿuPĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀĀu,￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿ux𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀𐀀u�􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿􏿿ZnnbPZnPnr��ii@z<stdin>rZ2Pn2P)Qr�r�rCr�calcobjsizer��check_sizeofr�r��	bytearray�	__alloc__�iter�__closure__r��complexr^rl�datetimeZ	timedeltaZdays�collections�defaultdict�default_factoryr��__add__�__iter__�keys�values�itemsr��__dict__�
BaseException�UnicodeEncodeError�UnicodeDecodeError�UnicodeTranslateError�EllipsisrOZencodings.iso8859_3�
charmap_build�	iso8859_3Zdecoding_tabler��reversed�floatr	r�r�r�currentframer��co_cellvars�co_freevars�co_stacksize�
co_nlocals�re�finditerr�r�r�r��NotImplementedr�r��	frozenset�slice�superr`ryr�r��erk�g�h�ord�max�chrr�weakref�ref�proxy)'rr�r�Zsamples�sampler�r�r�r�r�r�ZlongdictrbrO�	encodingsrZCO_MAXBLOCKSZncellsZnfrees�extrasr�r�r�rZPyLong_BASEZ
PySet_MINSIZErZminused�tmpZnewsize�fmtr��oZasciifieldsZ
compactfieldsZ
unicodefieldsZmaxchar�Lr��	__class__)r�rr�r�test_objecttypesKs**& ���"$$ 	


�"0"


zSizeofTest.test_objecttypescCsHt�|�t�|�}t�|�r2t�|�s2||j7}|�t�|�|�dSr!)r	r�r�r�rxZ
is_trackedr�r)rr$�base�extrarSrrr�check_slotsUs
zSizeofTest.check_slotsc	Cs�|j}Gdd�dt�}||�t�d�Gdd�dt�}||gd�dgid�Gdd	�d	t�}||�gd�Gd
d�dt�}||�t�d�Gdd
�d
t�}||�t�d�ddlm}Gdd�d|�}||gd�|gd�d�dS)Nc@seZdZdZdS)z!SizeofTest.test_slots.<locals>.BA�r`ryr�N�r(r)r*�	__slots__rrrr�BA_sr-r�c@seZdZdZdS)z SizeofTest.test_slots.<locals>.Dr*Nr+rrrr�Dbsr.r�r�c@seZdZdZdS)z SizeofTest.test_slots.<locals>.Lr*Nr+rrrrr#esr#c@seZdZdZdS)z SizeofTest.test_slots.<locals>.Sr*Nr+rrrrr
hsr
c@seZdZdZdS)z!SizeofTest.test_slots.<locals>.FSr*Nr+rrrr�FSksr/r)�OrderedDictc@seZdZdZdS)z!SizeofTest.test_slots.<locals>.ODr*Nr+rrrr�ODosr1)r)r�r7r�r�rr�r0)	rr�r-r.r#r
r/r0r1rrr�
test_slots[szSizeofTest.test_slotscCs�tjj}tjj}|j}ddl}||��|d��zt�Wn4tylt�	�d}|durh|||d��Yn0|tj
|d�|jttj
��dS)Nrr�r�Z2P2ir)
rCrr�r�r��_astZASTrr	r/r"r�r�)rr�r�r�r3�tbrrr�test_pythontypessszSizeofTest.test_pythontypescCs�t��}|�|j�|�|j�dd�}tj|d�t��}|�|j|�|�|d|�|�|jd�|�|dd�dd�}tj|d�t��}|�|j|�|�|d|�|�|j|�|�|d|�tj|�t��}|�|j�|�|j�dS)NcWsdSr!r�r`rrr�<lambda>�rLz0SizeofTest.test_asyncgen_hooks.<locals>.<lambda>)�	firstiterrrAcWsdSr!rr6rrrr7�rL)�	finalizer)r	�get_asyncgen_hooksrXr8r9�set_asyncgen_hooksrv)r�oldr8Zhooksr9Zcurrrr�test_asyncgen_hooks�s*
zSizeofTest.test_asyncgen_hookscCs6t�d�}td|�\}}}|�|d�|�|d�dS)Nz�
            import sys
            class MyStderr:
                def write(self, s):
                    sys.stderr = None
            sys.stderr = MyStderr()
            1/0
        rKrL)�textwrap�dedentrrr�rrr�/test_changing_sys_stderr_and_removing_reference�s
z:SizeofTest.test_changing_sys_stderr_and_removing_reference)r(r)r*r�rCrr�r�r�r�r&r)r2r5r=r@�
__classcell__rrr$rr�s	r��__main__)rCrrnrrr
rOrxr]r�r8r�r:r	r�Ztest.supportr>r�r9rZTestCaserr+rGr�r�r�r(�mainrrrr�<module>sF/(# 


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