ó
'![c           @   sÆ   d  d l  Z  d  d l m Z m Z m Z d  d l Z d  d l Z d  d l m Z e e e e	   d d  Z
 e e e e	   d d  Z d   Z d   Z d	   Z d
   Z d   Z d   Z d S(   iÿÿÿÿN(   t   joint   dirnamet   abspath(   t   similart   inputt   similar1t   similar2c          C   s   t  j   t _ t j t   }  t j d t	 t
 g  Wd  QX|  j j d k sU t  t j j   } t j t _ | j   d t	 t
 f j   k s t  d  S(   Ns   --ignore-commentsi    sÀ   
10 similar lines in 2 files
==%s:0
==%s:0
   import one
   from two import two
   three
   four
   five
   six
   seven
   eight
   nine
   ''' ten
TOTAL lines=44 duplicates=10 percent=22.73
(   t   sixt   StringIOt   syst   stdoutt   pytestt   raisest
   SystemExitR   t   Runt   SIMILAR1t   SIMILAR2t   valuet   codet   AssertionErrort   getvaluet
   __stdout__t   strip(   t   ext   output(    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_similar.pyt   test_ignore_comments   s    	c          C   s    t  j   t _ t j t   }  t j d t	 t
 g  Wd  QX|  j j d k sU t  t j j   } t j t _ | j   d t	 t
 f d j   k s t  d  S(   Ns   --ignore-docstringsi    s  
8 similar lines in 2 files
==%s:6
==%s:6
   seven
   eight
   nine
   ''' ten
   ELEVEN
   twelve '''
   thirteen
   fourteen

5 similar lines in 2 files
==%s:0
==%s:0
   import one
   from two import two
   three
   four
   five
TOTAL lines=44 duplicates=13 percent=29.55
i   (   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   (   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_similar.pyt   test_ignore_docsrings0   s    	c          C   s   t  j   t _ t j t   }  t j d t	 t
 g  Wd  QX|  j j d k sU t  t j j   } t j t _ | j   d j   k s t  d  S(   Ns   --ignore-importsi    s*   
TOTAL lines=44 duplicates=0 percent=0.00
(   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   (   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_similar.pyt   test_ignore_importsP   s    	c          C   s   t  j   t _ t j t   }  t j t	 t
 g  Wd  QX|  j j d k sR t  t j j   } t j t _ | j   d t	 t
 f j   k s t  d  S(   Ni    s   
5 similar lines in 2 files
==%s:0
==%s:0
   import one
   from two import two
   three
   four
   five
TOTAL lines=44 duplicates=5 percent=11.36
(   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   (   R   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_similar.pyt   test_ignore_nothing\   s    	
c          C   ss   t  j   t _ zP y t j d g  Wn( t k
 rP }  |  j d k s^ t  n Xt	 j
 d  Wd  t j t _ Xd  S(   Ns   --helpi    s   not system exit(   R   R   R	   R
   R   R   R   R   R   R   t   failR   (   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_similar.pyt	   test_helpp   s     c          C   sp   t  j   t _ zM y t j g   Wn( t k
 rM }  |  j d k s[ t  n Xt	 j
 d  Wd  t j t _ Xd  S(   Ni   s   not system exit(   R   R   R	   R
   R   R   R   R   R   R   R   R   (   R   (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_similar.pyt   test_no_args|   s     (   R	   t   os.pathR    R   R   R   R   t   pylint.checkersR   t   __file__R   R   R   R   R   R   R   R   (    (    (    sC   lib/python2.7/site-packages/pylint/test/unittest_checker_similar.pyt   <module>   s   		 			