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_repl.cpython-312.opt-1.pyc

�

'Μg���:�dZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZe	sejd��ejejd�d�Zd	�ZGd
�dej$�ZGd�d
ej$�Zedk(rej,�yy)z!Test the interactive interpreter.�N)�dedent)�cpython_only�has_subprocess_support�SuppressCrashReport)�kill_pythonztest module requires subprocess)�stdout�stderrc	��tjjtjjtj
�d�}|ddg}|j
|�|jdttj��}d|d<tj|ftj
dtj||d�|��S)	z�Run the Python REPL with the given arguments.

    kw is extra keyword args to pass to subprocess.Popen. Returns a Popen
    object.
    z<stdin>z-Ez-i�env�vt100�TERMT)�
executable�text�stdinrr	)
�os�path�join�dirname�sysr�extend�
setdefault�dict�environ�
subprocess�Popen�PIPE)rr	�args�kw�stdin_fname�cmd_liners       �+/usr/local/lib/python3.12/test/test_repl.py�
spawn_replr"s����'�'�,�,�r�w�w���s�~�~�>�	�J�K��T�4�(�H��O�O�D��
�-�-��t�B�J�J�/�
0�C��C��K����H�"�'*�~�~�!%�",�/�/�#)�&�	"�
!�"�"�c��t�}|jj|�t|�}|jdk7rtd��|S)z�Spawn a new Python interpreter, pass the given
    input source code from the stdin and return the
    result back. If the interpreter exits non-zero, it
    raises a ValueError.rzProcess didn't exit properly.)r"r�writer�
returncode�
ValueError)�source�process�outputs   r!�run_on_interactive_moder+,sF���l�G��M�M�����
��
!�F����Q���8�9�9��Mr#c�2�eZdZed��Zed��Zd�Zy)�TestInteractiveInterpreterc��d}t|�}t�}t�5|jj	|�ddd�t|�}|j
d|�|j
|jd�y#1swY�CxYw)Nz�
            import sys, _testcapi
            1/0
            print('After the exception.')
            _testcapi.set_nomemory(0)
            sys.exit(0)
        zAfter the exception.)��x)rr"rrr%r�assertInr&��self�
user_input�pr*s    r!�test_no_memoryz)TestInteractiveInterpreter.test_no_memory=sj��
�
��J�'�
��L��
 �
"�
�G�G�M�M�*�%�#��Q����
�
�,�f�5��
�
�a�l�l�H�-�#�
"�s�B�B	c��d}t|�}t�}|jj|�t	|�}|j|jd�y)Na        x = """<?xml version="1.0" encoding="iso-8859-1"?>
        <test>
            <Users>
                <fun25>
                    <limits>
                        <total>0KiB</total>
                        <kbps>0</kbps>
                        <rps>1.3</rps>
                        <connections>0</connections>
                    </limits>
                    <usages>
                        <total>16738211KiB</total>
                        <kbps>237.15</kbps>
                        <rps>1.3</rps>
                        <connections>0</connections>
                    </usages>
                    <time_to_refresh>never</time_to_refresh>
                    <limit_exceeded_URL>none</limit_exceeded_URL>
                </fun25>
            </Users>
        </test>"""
        r)rr"rr%r�assertEqualr&r2s    r!�test_multiline_string_parsingz8TestInteractiveInterpreter.test_multiline_string_parsingRsI���
�.�J�'�
��L��	���
�
�j�!��Q���������q�)r#c���td�}td�}td|�}|j|�d}|j|jd�|jd|�y)NzY
            import os
            print("before close")
            os.close(0)
        zl
            from test.support import suppress_msvcrt_asserts
            suppress_msvcrt_asserts()
        z-crzbefore close)rr"�communicater8r&r1)r3r4�prepare_replr)r*s     r!�test_close_stdinz+TestInteractiveInterpreter.test_close_stdinssi����
�
�
��
���T�<�0���$�$�Z�0��3������+�+�Q�/��
�
�n�f�-r#N)�__name__�
__module__�__qualname__rr6r9r=�r#r!r-r-;s.���.��.�(�*��*�@
.r#r-c��eZdZd�Zy)�TestInteractiveModeSyntaxErrorsc�~�ttd��}|j�dd}gd�}|j||�y)NzJ        def f():
            print(0)
            return yield 42
        ������)z    return yield 42z           ^^^^^zSyntaxError: invalid syntax)r+r�
splitlinesr8)r3r*�traceback_lines�expected_liness    r!�*test_interactive_syntax_error_correct_linezJTestInteractiveModeSyntaxErrors.test_interactive_syntax_error_correct_line�sH��(��1�*
���!�+�+�-�b��4��
��
	
����.�9r#N)r>r?r@rJrAr#r!rCrC�s��
:r#rC�__main__)�__doc__rr�unittestr�textwrapr�test.supportrrr�test.support.script_helperr�SkipTestr�STDOUTr"r+�TestCaser-rCr>�mainrAr#r!�<module>rUs���'�
�	����R�R�2��
�(�
�
�=�
>�>�(�_�_�Z�5F�5F�"�8�E.��!2�!2�E.�P:�h�&7�&7�:�$�z���H�M�M�O�r#

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