관리-도구
편집 파일: test_replace.cpython-36.opt-2.pyc
3 ��2aq � @ s� d dl mZ d dlZd dlmZ ed� d dlmZmZ d dlm Z d dl mZ d dlj ZejZejZG 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 � | _| jj� tt_tj| 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 �1/opt/alt/python36/lib64/python3.6/test_replace.py�<lambda> s 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_| `| `| `| jj� | `d S )N)� orig_mboxr r r r r r Zdestroy)r r r r � tearDownClass! s zReplaceDialogTest.tearDownClassc C s | j jdd� d S )N�insertzThis is a sample sTring)r r )�selfr r r �setUp( s zReplaceDialogTest.setUpc C s� | j jjd� | jjjd� | j jjd� | j jjd� | j jjd� | j jjd� | j j jd� dt _dt _| j jdd� 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}| jjd� || jj� |j � � |j d� |j d� |� ||j dd�d� |jdd� |j d� |j d� |� ||j d d �d� |j d� |j d� |� ||j d d�d� |jdd� |jdd� |j dd�}|j d� |� |j dd�}|||� |jdd� |j d� |j d� |� ||j d�d� ||j d�d� |� ||j d�d� ||j d�d� |j dd�}|� |j dd�}|||� |j dd�}|j d� |� |j dd�}|||� | jj 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}| jjjd� |j dd� |jd� |jd� |� ||j d�d� ||j d�d� |� ||j d�d� ||j d�d� |� ||j d�d� |j dd � |jd � |j dd�}|� |j dd�}|||� d S ) NFr z1.4r- r. z1.2z1.5z1.20z1.8r* z1.0r )r r0 r r r r r1 r"