Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_atexit.cpython-312.opt-2.pyc

�

&Μg����ddlZddlZddlZddlZddlmZddlmZGd�dej�Z	Gd�dej�Z
ejGd�d	ej��Ze
d
k(rej�yy)�N)�support)�
script_helperc��eZdZd�Zy)�GeneralTestc�X�tjd�}tj|�y)Nz_test_atexit.py)r�findfiler�run_test_script)�self�scripts  �-/usr/local/lib/python3.12/test/test_atexit.py�test_generalzGeneralTest.test_general
s!���!�!�"3�4���%�%�f�-�N)�__name__�
__module__�__qualname__r
�rrrr	s��.rrc��eZdZd�Zd�Zy)�FunctionalTestc��tjd�}tjd|�}|j	|j
j
�j�ddg�|j|j�y)Nz�
            import atexit

            def f(msg):
                print(msg)

            atexit.register(f, "one")
            atexit.register(f, "two")
        �-c�two�one�
�textwrap�dedentr�assert_python_ok�assertEqual�out�decode�
splitlines�assertFalse�err�r
�code�ress   r�
test_shutdownzFunctionalTest.test_shutdownsc����� �
���,�,�T�4�8����������)�4�4�6����G�������!rc��tjd�}tjd|�}|j	|j
j
�j�ddg�|j|j�y)Na@
            import sys
            import atexit as atexit1
            del sys.modules['atexit']
            import atexit as atexit2
            del sys.modules['atexit']

            assert atexit2 is not atexit1

            atexit1.register(print, "atexit1")
            atexit2.register(print, "atexit2")
        r�atexit2�atexit1rr#s   r�test_atexit_instancesz$FunctionalTest.test_atexit_instancessd����� �
���,�,�T�4�8����������)�4�4�6��I�8N�O�������!rN)rrrr&r*rrrrrs��
"�"rrc�X�eZdZd�Zd�Zejeed�d�d��Z	y)�SubinterpreterTestc���tj�}tjd�}t	j
|�}|j
|d�|j
tj�|�y)Nz�
            import atexit
            def f():
                pass
            atexit.register(f)
            del atexit
        r��atexit�_ncallbacksrrr�run_in_subinterpr�r
�nr$�rets    r�test_callbacks_leakz&SubinterpreterTest.test_callbacks_leak5s`��
��� ����� �
���&�&�t�,������a� �����+�+�-�q�1rc���tj�}tjd�}t	j
|�}|j
|d�|j
tj�|�y)Nz�
            import atexit
            def f():
                pass
            atexit.register(f)
            atexit.__atexit = atexit
        rr.r2s    r�test_callbacks_leak_refcyclez/SubinterpreterTest.test_callbacks_leak_refcycleEs`��
��� ����� �
���&�&�t�,������a� �����+�+�-�q�1r�pipezrequires os.pipe()c�Z�d}tj�\}}tjdj	|��}tj|�}tj|�|jtj|t|��|�tj|�y)NsThe test has passed!z�
            import os
            import atexit
            def callback():
                os.write({:d}, b"The test has passed!")
            atexit.register(callback)
        )�osr8rr�formatrr1�closer�read�len)r
�expected�r�wr$r4s      r�(test_callback_on_subinterpreter_teardownz;SubinterpreterTest.test_callback_on_subinterpreter_teardownTs}��+���w�w�y���1���� �
�F�1�I�
���&�&�t�,��
������������C��M�2�H�=�
����rN)
rrrr5r7�unittest�
skipUnless�hasattrr:rBrrrr,r,2s8��2� 
2��X�����V�,�.B�C��D�rr,�__main__)r/r:rrC�testr�test.supportr�TestCaserr�cpython_onlyr,r�mainrrr�<module>rLs~��
�	����&�.�(�#�#�.� "�X�&�&� "�F	���2��*�*�2��2�j�z���H�M�M�O�r

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