Format: application/x-python-code
1 o
2
3 ��h�Z � @ s� d Z ddlZddlZddlZejedd�� ddlmZ W d � n1 s&w Y ddl m
4 Z
5 ddlmZm
6 Z
7 ddlmZ d d
8 � Zdd� Zd
9 d� Zdd� Zdd� ZG dd� dej�ZG dd� dej�ZG dd� dej�ZG dd� de�Zedkr�ddlmZ e� dZZdZz9 eZ e�!� r�de�"� Z#er�e#e$e e# � Z%ne$e �Z%e�&e%� d Z e�!� s�ej'Z(e�)� Z*e+d!e*� e+d"e(� q� e,y� e+d#� Y nw d$d%� Z-d&d'� Z.G d(d)� d)e/�Z0G d*d+� d+e0ej�Z1G d,d-� d-e0ej�Z2g d.�Z3d/d0� Z4dS )1z#Tests for the inputsplitter module.� N�
10 inputsplitter)�match)r )�InputTransformer)�syntax� syntax_ml)�toolsc C sX ddl m} |� }|�� r&d|�� }d| }|| |� }|�|� |�� s
11 |�� }|S )z�Minimal example of the logic of an interactive interpreter loop.
12
13 This serves as an example, and it is used by the test system with a fake
14 raw_input that simulates interactive input.r )�
15 InputSplitter� z>>> )�IPython.core.inputsplitterr �push_accepts_more�get_indent_spaces�push�source_reset)Z
16 input_funcr �isp�indent�prompt�line�src� r �[c:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/core/tests/test_inputsplitter.py�mini_interactive_loop s
17 �r c s t | �� � fdd�}|S )zDReturn a function that acts like raw_input but feeds the input list.c s zt � �W S ty Y dS w )N� )�next�
18 StopIteration)r �Zilinesr r �raw_in9 s
19
20 �zpseudo_input.<locals>.raw_in)�iter)�linesr r r r �pseudo_input6 s r c C sF g d�} t �t�� t�tj| � W d � d S 1 sw Y d S )N)
21 �r r )r � )�
22 r )z
23 r )�xr )z xr )z x� )z x� )z xr )z xr# )�pytest�warns�PendingDeprecationWarning�tt�check_pairsr Znum_ini_spaces��testsr r r �test_spacesC s "�r, c C s g d�} t �tj| � d S )N))�textr- )ztext # commentztext )ztext # comment
24 �text
25 )ztext # comment
26 r. )zline # c
27 line
28 zline
29 line
30 )z"line # c
31 line#c2
32 line
33 line #c
34
35 zline
36 line
37 line
38 line
39
40 )r( r) r Zremove_commentsr* r r r �test_remove_commentsT s r/ c C s, t �� } t| t�sJ �d�| �dksJ �d S )N�tests test)r �get_input_encoding�
41 isinstance�str�encode)�encodingr r r �test_get_input_encoding` s r6 c @ �$ e Zd Zdd� Zdd� Zdd� ZdS )�NoInputEncodingTestCasec C s&