Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_repl.cpython-310.pyc

o

0�i��@s�dZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZejej
d�dd�ZGd	d
�d
ej�ZedkrCe��dSdS)z!Test the interactive interpreter.�N)�dedent)�cpython_only�SuppressCrashReport)�kill_python)�stdout�stderrcOshtj�tj�tj�d�}|ddg}|�|�|�dttj	��}d|d<t
j|ftjdt
j||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�envZvt100ZTERMT)�
executable�text�stdinrr)
�os�path�join�dirname�sysr	�extend�
setdefault�dict�environ�
subprocess�Popen�PIPE)rr�args�kwZstdin_fnameZcmd_liner�r�5/opt/alt/python310/lib64/python3.10/test/test_repl.py�
spawn_repls

��rc@s,eZdZedd��Zedd��Zdd�ZdS)�TestInteractiveInterpretercCsjd}t|�}t�}t��|j�|�Wd�n1swYt|�}|�d|�|�|jd�dS)Nz�
            import sys, _testcapi
            1/0
            print('After the exception.')
            _testcapi.set_nomemory(0)
            sys.exit(0)
        zAfter the exception.)��x)rrrr�writer�assertIn�
returncode��self�
user_input�p�outputrrr�test_no_memory)s�z)TestInteractiveInterpreter.test_no_memorycCs8d}t|�}t�}|j�|�t|�}|�|jd�dS)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)rrrr r�assertEqualr"r#rrr�test_multiline_string_parsing>sz8TestInteractiveInterpreter.test_multiline_string_parsingcCsFtd�}td�}td|�}|�|�d}|�|jd�|�d|�dS)NzY
            import os
            print("before close")
            os.close(0)
        zl
            from test.support import suppress_msvcrt_asserts
            suppress_msvcrt_asserts()
        z-crzbefore close)rrZcommunicater)r"r!)r$r%Zprepare_replZprocessr'rrr�test_close_stdin_s
z+TestInteractiveInterpreter.test_close_stdinN)�__name__�
__module__�__qualname__rr(r*r+rrrrr's

 r�__main__)�__doc__rrZunittestr�textwraprZtest.supportrrZtest.support.script_helperrrZSTDOUTrZTestCaserr,�mainrrrr�<module>sH�