3 fd @ s d Z ddlmZ ddlZddlmZ ddlmZ ddlZG dd dZ e Z G dd d Ze ZG d d dej ZG dd d ej ZG dd dej Zedkrejdd dS )a !Changing this line will break Test_findfile.test_found! Non-gui unit tests for grep.GrepDialog methods. dummy_command calls grep_it calls findfiles. An exception raised in one method will fail callers. Otherwise, tests are mostly independent. Currently only test grep_it, coverage 51%. ) GrepDialogN)captured_stdout)Varc @ s e Zd ZdZdd ZdS )Dummy_searchenginezGrepDialog.__init__ calls parent SearchDiabolBase which attaches the passed in SearchEngine instance as attribute 'engine'. Only a few of the many possible self.engine.x attributes are needed here. c C s | j S )N)_pat)self r @/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_grep.pygetpat s zDummy_searchengine.getpatN)__name__ __module____qualname____doc__r r r r r r s r c @ s, e Zd ZejZejZedZeZ dd Z dS ) Dummy_grepFc C s d S )Nr )r r r r close" s zDummy_grep.closeN)r r r r grep_itZ findfilesr Zrecvarsearchengineenginer r r r r r s r c @ s e Zd ZdS ) FindfilesTestN)r r r r r r r r ( s r c @ s$ e Zd Zdd Zdd Zdd ZdS )Grep_itTestc C sF |t j_t }t jtj|t W d Q R X |j j d}|j |S )N )grepr r r r recompile__file__getvaluesplitpop)r patslinesr r r report5 s zGrep_itTest.reportc C sF dd }| j |}| jt|d | j||d | j|d d d S )Nzxyz* r zNo hits.)r! assertEquallenassertIn)r r r r r r test_unfound= s zGrep_itTest.test_unfoundc C sf d}| j |}| jt|d | j||d | jd|d | jd|d | j|d jd d S ) Nz<""" !Changing this line will break Test_findfile.test_found! r zpy: 1:r$ 2 z(Hint:)r! r% r&