Your IP : 3.141.38.137


Current Path : /opt/alt/python37/lib64/python3.7/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/idle_test/__pycache__/test_editor.cpython-37.pyc

B

� fc�@s�dZddlmZddlZddlmZddlmZddlm	Z	ddl
mZejZ
Gdd	�d	ej�ZGd
d�dej�Zdd
�ZGdd�dej�ZGdd�dej�Zedkr�ejdd�dS)zTest editor, coverage 35%.�)�editorN)�
namedtuple)�requires)�Tk)�Funcc@s,eZdZedd��Zedd��Zdd�ZdS)�EditorWindowTestcCstd�t�|_|j��dS)N�gui)rr�root�withdraw)�cls�r�B/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_editor.py�
setUpClassszEditorWindowTest.setUpClasscCsB|j��x$|jj�dd�D]}|j�|�qW|j��|`dS)N�after�info)r	�update_idletasks�tk�call�after_cancel�destroy)r�idrrr
�
tearDownClasss


zEditorWindowTest.tearDownClasscCs(t|jd�}|�|j|j�|��dS)N)r	)�Editorr	�assertEqual�_close)�self�errr
�	test_initszEditorWindowTest.test_initN)�__name__�
__module__�__qualname__�classmethodrrrrrrr
r
src@s$eZdZdd�Zdd�Zdd�ZdS)�TestGetLineIndentcCsPxJdD]B}x<dD]4}|j||d��|�tj||d�d�WdQRXqWqWdS)N)�����)��
)�line�tabwidth)r+)rr)�subTestrr�get_line_indent)rr+r*rrr
�test_empty_lines$s

z"TestGetLineIndent.test_empty_linesc
CsHd}x>|D]6\}}|j|d��|�tj|dd�|�WdQRXq
WdS)N))z	no spaces)rr)z    space test)r%r%)z		tab test)r#r%)z		double tabs test)r$r')z    	mixed test)�r')z  	  mixed test)r/r&)z	    mixed test)r/r')z
  	mixed test)�r%)z
 	 mixed test)r0r/)z
	  mixed test)r0r&)z
newline test)rr)r*r%)r+)r,rrr-)r�testsr*�expectedrrr
�test_tabwidth_4-sz!TestGetLineIndent.test_tabwidth_4c
CsHd}x>|D]6\}}|j|d��|�tj|dd�|�WdQRXq
WdS)N))z	no spaces)rr)z        space test)r'r')z		tab test)r#r')z		double tabs test)r$�)z        	mixed test)�	r4)z      	  mixed test)r5�
)z	        mixed test)r5r4)z
  	mixed test)r0r')z
 	 mixed test)r0r5)z
	  mixed test)r0r6)z
newline test)rr)r*r')r+)r,rrr-)rr1r*r2rrr
�test_tabwidth_8Fsz!TestGetLineIndent.test_tabwidth_8N)rrr r.r3r7rrrr
r"#s	r"cCs$|�dd�|�d|�|��dS)Nz1.0�end)�delete�insert�update)�text�stringrrr
r:`sr:c@s,eZdZedd��Zedd��Zdd�ZdS)�IndentAndNewlineTestcCs<td�t�|_|j��t|jd�|_d|j_d|j_dS)Nr)r	r$)rrr	r
r�windowZindentwidthr+)rrrr
rhs
zIndentAndNewlineTest.setUpClasscCsP|j��|`|j��x$|jj�dd�D]}|j�|�q*W|j��|`dS)Nrr)r?rr	rrrrr)rrrrr
rqs


z"IndentAndNewlineTest.tearDownClassc	
Csl|j}|j}|j}|j}|j}tdddddg�}|dddd	�|d
ddd
�|dddd�|dddd�|dddd�|dddd	�|dddd�|ddd d	�|d!dd"d�f	}d#|_x\|D]T}|j|jd$��<t	||j�|�
d%|j�|dd&�||d'd(�|j�WdQRXq�Wt	|d)�|�
d*d+d	�|d�||d'd(�d,�d-|_t	|d.�|�
d%d/�|d�||d'd(�d0�dS)1NZTests�labelr<r2�markz"Empty line inserts with no indent.z  
  def __init__(self):z
  
  def __init__(self):
z1.endz+Inside bracket before space, deletes space.z  def f1(self, a, b):z  def f1(self,
         a, b):
z1.14z*Inside bracket after space, deletes space.z1.15z(Inside string with one line - no indent.z  """Docstring."""z  """Docstring.
"""
z&Inside string with more than one line.z%  """Docstring.
  Docstring Line 2"""z)  """Docstring.
  Docstring Line 2
  """
z2.18zBackslash with one line.za =\za =\
  
z"Backslash with more than one line.za =\
          multiline\z%a =\
          multiline\
          
z2.endz Block opener - indents +1 level.z  def f1(self):
    passz  def f1(self):
    
    pass
z Block closer - dedents -1 level.z  def f1(self):
    pass
  
r()r@r:)Zeventz1.0r8z&  def f1(self, a, b):
    return a + bZselz1.17z-  def f1(self, a,
         
    return a + b
z>>> z	>>> 		a =z1.5z	>>> 
a =
)rr?r<�getZnewline_and_indent_eventrZprompt_last_liner,r@r:Zmark_setrAr2Ztag_add)	r�eq�wr<rB�nlZTestInfor1Ztestrrr
�test_indent_and_newline_event{st

 

z2IndentAndNewlineTest.test_indent_and_newline_eventN)rrr r!rrrFrrrr
r>fs	
r>c@s:eZdZedd��Zedd��ZGdd�d�Zdd�Zd	S)
�	RMenuTestcCs,td�t�|_|j��t|jd�|_dS)Nr)r	)rrr	r
rr?)rrrr
r�s
zRMenuTest.setUpClasscCsP|j��|`|j��x$|jj�dd�D]}|j�|�q*W|j��|`dS)Nrr)r?rr	rrrrr)rrrrr
r�s


zRMenuTest.tearDownClassc@seZdZdd�ZdS)zRMenuTest.DummyRMenucCsdS)Nr)�x�yrrr
�tk_popup��zRMenuTest.DummyRMenu.tk_popupN)rrr rJrrrr
�
DummyRMenu�srLcCsdS)Nr)rrrr
�test_rclick�szRMenuTest.test_rclickN)rrr r!rrrLrMrrrr
rG�s
rG�__main__r$)�	verbosity)�__doc__ZidlelibrZunittest�collectionsrZtest.supportrZtkinterrZidlelib.idle_test.mock_idlerZEditorWindowrZTestCaserr"r:r>rGr�mainrrrr
�<module>s=[

?>