관리-도구
편집 파일: test_replace.cpython-37.opt-2.pyc
B YI~dq � @ s� d dl mZ d dlZd dlmZ ed� d dlmZmZ d dlm Z d dl mZ d dlm Z ejZejZG dd � d ej�Zed kr�ejdd� dS ) � )� ReplaceDialogN)�requiresZgui)�Tk�Text)�Mock)�Mboxc @ st e Zd Zedd� �Zedd� �Zdd� Zdd� Zd d � Zdd� Z d d� Z dd� Zdd� Zdd� Z dd� Zdd� ZdS )�ReplaceDialogTestc C sz t � | _| j�� tt_t�| j�| _t| j| j�| _ dd� | j _ t� | j _t | j�| _t� | j_t� | j_| j| j _d S )Nc S s d S )N� r r r �C/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_replace.py�<lambda> � z.ReplaceDialogTest.setUpClass.<locals>.<lambda>)r �rootZwithdrawr �se�tkMessageBoxZSearchEngine�enginer �dialogZbellr �okr �textZundo_block_startZundo_block_stop)�clsr r r � setUpClass s zReplaceDialogTest.setUpClassc C s$ t t_| `| `| `| j�� | `d S )N)� orig_mboxr r r r r r Zdestroy)r r r r � tearDownClass! s zReplaceDialogTest.tearDownClassc C s | j �dd� d S )N�insertzThis is a sample sTring)r r )�selfr r r �setUp( s zReplaceDialogTest.setUpc C s� | j j�d� | jj�d� | j j�d� | j j�d� | j j�d� | j j�d� | j j �d� dt _dt _| j �dd� d S )N� FTz1.0�end)r �patvar�setr �replvar�wordvar�casevar�revar�wrapvar�backvar� showerror�title�messager �delete)r r r r �tearDown+ s zReplaceDialogTest.tearDownc C s� | j }| j}| jj}| jj}| jj}| j�d� || j�� |� � � |� d� |� d� |� ||� dd�d� |�dd� |� d� |� d� |� ||� d d �d� |� d� |� d� |� ||� d d�d� |�dd� |�dd� |� dd�}|� d� |� |� dd�}|||� |�dd� |� d� |� d� |� ||� d�d� ||� d�d� |� ||� d�d� ||� d�d� |� dd�}|� |� dd�}|||� |� dd�}|� d� |� |� dd�}|||� | j� d� d S )NZasdf�az1.8z1.12r z1.0�is�helloz1.2z1.7�stringZworldz1.23z1.28r z line42:z [a-z][\d]+z1.9�i�jz2.1�foobarr )r �assertEqualr r r r � replace_itZsetpatZgetpat�getr �mark_setr Zfind_it)r r �equal�pv�rv�replace�before_text� after_textr r r �test_replace_simple7 s\ z%ReplaceDialogTest.test_replace_simplec C s� | j }| j}| jj}| jj}| jj}| jj�d� |� dd� |�d� |�d� |� ||� d�d� ||� d�d� |� ||� d�d� ||� d�d� |� ||� d�d� |� dd � |�d � |� dd�}|� |� dd�}|||� d S ) NFr z1.4r. r/ z1.2z1.5z1.20z1.8r+ z1.0r )r r1 r r r r r2 r# r r4 r3 )r r r5 r6 r7 r8 r9 r: r r r �test_replace_wrap_around} s. z*ReplaceDialogTest.test_replace_wrap_aroundc C st | j }| j}| jj}| jj}| jj}| jj�d� |�d� |�d� |� ||� dd�d� ||� dd�d� d S ) NTr+ r, z1.0z1.4�Thisz1.5z1.10) r r1 r r r r r2 r r r3 )r r r5 r6 r7 r8 r r r �test_replace_whole_word� s z)ReplaceDialogTest.test_replace_whole_wordc C s� | j }| j}| jj}| jj}| jj}| jj�d� | j� dd�}|�d� |�d� |� | j� dd�}|||� |�d� |� ||� dd�d� d S )NTz1.0r �this�thatr= z1.4) r1 r r r r r r2 r! r r3 )r r5 r r6 r7 r8 r9 r: r r r �test_replace_match_case� s z)ReplaceDialogTest.test_replace_match_casec C sJ | j }| j}| jj}| jj}| jj}| jj�d� |� dd�}|�d� |�d� |� |� dd�}|||� |� dd� |� ||� dd �d � |�d� |� | �dtj � | �d tj� |�d� |� | �dtj � | �dtj� dt_ dt_|�d� |�d� |� | �dtj � | �dtj� | j�d� ||� � d� d S )NTz1.0r z [a-z][\d]+r, r z line42z2.0z2.8Zlinhellor �error�Emptyz[\d�Patternz[a]ztest\zInvalid Replace Expression�?z\?)r1 r r r r r r2 r"