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_audit.cpython-39.opt-1.pyc

a

��g1�@svdZddlZddlZddlZddlmZeed�r<eed�sFe�d��e�d�Z	Gdd	�d	ej
�Zed
krre�
�dS)z)Tests for sys.audit and sys.addaudithook
�N)�support�addaudithook�auditz.test only relevant when sys.audit is availablezaudit-tests.pyc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)$�	AuditTestcGs�tjtjdtg|�dtjtjd��L}|��tj�|j�tj	�|j	�|j
r`|�d�|j	��Wd�n1st0YdS)N�-X utf8�utf-8��encoding�stdout�stderr�)
�
subprocess�Popen�sys�
executable�AUDIT_TESTS_PY�PIPE�waitr
�
writelinesr�
returncode�fail�join)�self�args�p�r�+/usr/local/lib/python3.9/test/test_audit.py�do_tests�zAuditTest.do_testcGs�g}tjtjdtg|�dtjtjd��F}|��tj�|j�|j	dd�|j
D�d�|j�fWd�S1sr0YdS)NrrrcSsg|]}|���d��qS)� )�strip�	partition)�.0�linerrr�
<listcomp>)�z(AuditTest.run_python.<locals>.<listcomp>r)r
rrrrrrrrrr
r)rr�eventsrrrr�
run_pythons�
�zAuditTest.run_pythoncCs|�d�dS)N�
test_basic�r�rrrrr'-szAuditTest.test_basiccCs|�d�dS)N�test_block_add_hookr(r)rrrr*0szAuditTest.test_block_add_hookcCs|�d�dS)N�!test_block_add_hook_baseexceptionr(r)rrrr+3sz+AuditTest.test_block_add_hook_baseexceptioncCst�d�|�d�dS)N�marshal�test_marshal�r�
import_modulerr)rrrr-6s
zAuditTest.test_marshalcCst�d�|�d�dS)N�pickle�test_pickler.r)rrrr1;s
zAuditTest.test_picklecCs|�d�dS)N�test_monkeypatchr(r)rrrr2@szAuditTest.test_monkeypatchcCs|�dtj�dS)N�	test_open)rrZTESTFNr)rrrr3CszAuditTest.test_opencCs|�d�dS)N�
test_cantracer(r)rrrr4FszAuditTest.test_cantracecCs|�d�dS)N�	test_mmapr(r)rrrr5IszAuditTest.test_mmapcCs6|�d�\}}}|s$|�d|���|�dg|�dS)N�test_excepthookzExpected fatal exception
)zsys.excepthookrzRuntimeError('fatal-error'))r&r�assertSequenceEqual�rrr%rrrrr6Ls�zAuditTest.test_excepthookcCsJ|�d�\}}}|r|�|�|�|ddd�|�|ddd�dS)N�test_unraisablehookrzsys.unraisablehook�zDRuntimeError('nonfatal-error') Exception ignored for audit hook test)r&r�assertEqualr8rrrr9Us

�zAuditTest.test_unraisablehookcCs�t�d�|�d�\}}}|r(|�|�|�|ddd�|�|ddd�|dd}|�|�|�dd	|�d
�g|d�|�dd	|�d�g|d�|�d
d	|g|d�dS)N�winreg�test_winregrzwinreg.OpenKey�zwinreg.OpenKey/resultr:zwinreg.EnumKeyrz 0z 10000�zwinreg.PyHKEY.Detach�)rr/r&rr;�
assertTruer7)rrr%rZexpectedrrrr=`s


zAuditTest.test_winregcCs�t�d�|�d�\}}}|r(|�|�tjr<t|ddi�|�|ddd�|�|ddd�|�|d	dd
�|�|d	d	�d��dS)N�socket�test_socket�sep�
rzsocket.gethostnamer>zsocket.__new__r:zsocket.bindz('127.0.0.1', 8080))	rr/r&r�verbose�printr;rA�endswithr8rrrrCns

zAuditTest.test_socketcCsP|�d�\}}}|r|�|�tjr2t|ddi�|�dd�|D�gd��dS)N�test_gcrDrEcSsg|]}|d�qS)rr)r!�eventrrrr#�r$z%AuditTest.test_gc.<locals>.<listcomp>)zgc.get_objectszgc.get_referrerszgc.get_referents)r&rrrFrGr;r8rrrrI{s
�zAuditTest.test_gccCs"|�d�\}}}|r|�|�dS)N�test_not_in_gc)r&r)rr�_rrrrrK�szAuditTest.test_not_in_gcN)�__name__�
__module__�__qualname__rr&r'r*r+r-r1r2r3r4r5r6r9r=rCrIrKrrrrrs"
	
r�__main__)�__doc__r
rZunittest�testr�hasattrZSkipTestZfindfilerZTestCaserrM�mainrrrr�<module>s

~

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