• File: test_editor.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/idlelib/idle_test/__pycache__/test_editor.cpython-37.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 6.52 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Njc@sdZddlmZddlZddlmZddlmZddlm	Z	ddl
mZejZ
Gdd	d	ejZGd
ddejZdd
ZGdddejZGdddejZedkrejdddS)zTest editor, coverage 35%.)editorN)
namedtuple)requires)Tk)Funcc@s,eZdZeddZeddZddZdS)EditorWindowTestcCstdt|_|jdS)Ngui)rrrootwithdraw)clsrB/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_editor.py
setUpClassszEditorWindowTest.setUpClasscCsB|jx$|jjddD]}|j|qW|j|`dS)Nafterinfo)r	update_idletaskstkcallafter_canceldestroy)ridrrr

tearDownClasss


zEditorWindowTest.tearDownClasscCs(t|jd}||j|j|dS)N)r	)Editorr	assertEqual_close)selferrr
	test_initszEditorWindowTest.test_initN)__name__
__module____qualname__classmethodrrrrrrr
r
src@s$eZdZddZddZddZdS)TestGetLineIndentcCsPxJdD]B}x<dD]4}|j||d|tj||ddWdQRXqWqWdS)N))
)linetabwidth)r+)rr)subTestrrget_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-)rtestsr*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.0end)deleteinsertupdate)textstringrrr
r:`sr:c@s,eZdZeddZeddZddZdS)IndentAndNewlineTestcCs<tdt|_|jt|jd|_d|j_d|j_dS)Nr)r	r$)rrr	r
rwindowZindentwidthr+)rrrr
rhs
zIndentAndNewlineTest.setUpClasscCsP|j|`|jx$|jjddD]}|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"df	}d#|_x\|D]T}|j|jd$<t	||j|
d%|j|dd&||d'd(|jWdQRXqWt	|d)|
d*d+d	|d||d'd(d,d-|_t	|d.|
d%d/|d||d'd(d0dS)1NZTestslabelr<r2markz"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)	reqwr<rBnlZTestInfor1Ztestr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:eZdZeddZeddZGdddZddZd	S)
	RMenuTestcCs,tdt|_|jt|jd|_dS)Nr)r	)rrr	r
rr?)rrrr
rs
zRMenuTest.setUpClasscCsP|j|`|jx$|jjddD]}|j|q*W|j|`dS)Nrr)r?rr	rrrrr)rrrrr
rs


zRMenuTest.tearDownClassc@seZdZddZdS)zRMenuTest.DummyRMenucCsdS)Nr)xyrrr
tk_popupzRMenuTest.DummyRMenu.tk_popupN)rrr rJrrrr

DummyRMenusrLcCsdS)Nr)rrrr
test_rclickszRMenuTest.test_rclickN)rrr r!rrrLrMrrrr
rGs
rG__main__r$)	verbosity)__doc__ZidlelibrZunittestcollectionsrZtest.supportrZtkinterrZidlelib.idle_test.mock_idlerZEditorWindowrZTestCaserr"r:r>rGrmainrrrr
<module>s=[