o
    bi                     @   s   d dl Z d dlmZmZmZ d dlmZ d dlmZ d dl	Z	d dl
mZ eeeeddZeeeeddZeeeedd	Zeeeedd
Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd ZdS )    N)joindirnameabspath)redirect_stdout)StringIO)similarinputZsimilar1Zsimilar2zmultiline-importzhide_code_with_imports.pyc               	   C   s   t  } t| % tt}tdttg W d    n1 s w   Y  W d    n1 s/w   Y  |j	j
dks<J |   dttf  ksLJ d S )Nz--ignore-commentsr   z
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
r   r   pytestraises
SystemExitr   RunSIMILAR1SIMILAR2valuecodegetvaluestripoutputex r   c/var/www/secure340b-portal/env/lib/python3.10/site-packages/pylint/test/unittest_checker_similar.pytest_ignore_comments   s    

r   c               	   C   s   t  } t| % tt}tdttg W d    n1 s w   Y  W d    n1 s/w   Y  |j	j
dks<J |   dttfd   ksNJ d S )Nz--ignore-docstringsr   a  
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
   r	   r   r   r   r   test_ignore_docsrings:   s    


r   c               	   C   s   t  } t| % tt}tdttg W d    n1 s w   Y  W d    n1 s/w   Y  |j	j
dks<J |   d ksHJ d S )N--ignore-importsr   z*
TOTAL lines=44 duplicates=0 percent=0.00
r	   r   r   r   r   test_ignore_imports^       

r   c               	   C   s   t  } t| $ tt}tttg W d    n1 sw   Y  W d    n1 s.w   Y  |jj	dks;J | 
  dttf  ksKJ d S )Nr   z
8 similar lines in 2 files
==%s:0
==%s:0
   from foo import (
     bar,
     baz,
     quux,
     quuux,
     quuuux,
     quuuuux,
   )
TOTAL lines=16 duplicates=8 percent=50.00
r   r   r
   r   r   r   r   	MULTILINEr   r   r   r   r   r   r   r   test_multiline_importsk   s    

r!   c               	   C   s   t  } t| % tt}tdttg W d    n1 s w   Y  W d    n1 s/w   Y  |jj	dks<J | 
  d ksHJ d S )Nr   r   z*
TOTAL lines=16 duplicates=0 percent=0.00
r   r   r   r   r   test_ignore_multiline_imports   r   r"   c               	   C   s   t  } t| ( tt}tdgdtg   W d    n1 s#w   Y  W d    n1 s2w   Y  |jj	dks?J d| 
 v sGJ d S )Nr   r   r   z*TOTAL lines=32 duplicates=16 percent=50.00)r   r   r
   r   r   r   r   HIDE_CODE_WITH_IMPORTSr   r   r   r   r   r   r   test_no_hide_code_with_imports   s    r$   c               	   C   s   t  } t| $ tt}tttg W d    n1 sw   Y  W d    n1 s.w   Y  |j	j
dks;J |   dttf  ksKJ d S )Nr   z
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   test_ignore_nothing   s    

r%   c                  C   s   t  } t| 8 ztdg W n ty) } z|jdksJ W Y d }~nd }~ww td W d    d S W d    d S 1 sBw   Y  d S )Nz--helpr   not system exitr   r   r   r   r   r   r
   Zfailr   r   r   r   	test_help   s   
"r(   c                  C   s   t  } t| 7 ztg  W n ty( } z|jdksJ W Y d }~nd }~ww td W d    d S W d    d S 1 sAw   Y  d S )N   r&   r'   r   r   r   r   test_no_args   s   
"r*   )sysos.pathr   r   r   
contextlibr   ior   r
   Zpylint.checkersr   __file__r   r   r    r#   r   r   r   r!   r"   r$   r%   r(   r*   r   r   r   r   <module>   s*   $