a
    åze
  ã                   @   sj   d Z ddlmZ edƒ ddlZddlmZ ddlZddlmZ G dd„ dej	ƒZ
ed	krfejd
d dS )zNTest (selected) IDLE Edit menu items.

Edit modules have their own test files
é    )ÚrequiresZguiN)Úttk)Úpyshellc                   @   s@   e Zd ZdZedd„ ƒZedd„ ƒZdd„ Zdd	„ Zd
d„ Z	dS )Ú	PasteTestzeTest pasting into widgets that allow pasting.

    On X11, replacing selections requires tk fix.
    c                 C   sh   t  ¡  | _}| j ¡  t |¡ t  |¡| _t  |¡| _	t
 |¡| _t  |¡| _| ¡  | d¡ d S )NÚtwo)ÚtkZTkÚrootZwithdrawr   Zfix_x11_pasteÚTextÚtextZEntryÚentryr   ÚtentryZSpinboxÚspinÚclipboard_clearZclipboard_append)Úclsr   © r   ú5/usr/lib/python3.9/idlelib/idle_test/test_editmenu.pyÚ
setUpClass   s    

zPasteTest.setUpClassc                 C   s2   | ` | `| `| j ¡  | j ¡  | j ¡  | `d S )N)r
   r   r   r   r   Zupdate_idletasksZdestroy)r   r   r   r   ÚtearDownClass   s
    


zPasteTest.tearDownClassc              	   C   s~   | j }dD ]n\}}| j||dH | dd¡ | dd|¡ | d¡ |  | dd¡|¡ W d  ƒ q
1 sn0    Y  q
dS )z4Test pasting into text with and without a selection.))Ú zonetwo
)Zselztwo
)ÚtagÚansz1.0ÚendÚoneú	<<Paste>>N)r
   ÚsubTestÚdeleteÚinsertÚevent_generateÚassertEqualÚget)Úselfr
   r   r   r   r   r   Útest_paste_text%   s    
zPasteTest.test_paste_textc              
   C   s’   | j | jfD ]€}dD ]v\}}| j|||dN | dd¡ | dd¡ | d|¡ | d¡ |  | ¡ |¡ W d  ƒ q1 s€0    Y  qqdS )z8Test pasting into an entry with and without a selection.©)r   Zonetwo)r   r   )r   r   r   r   r   r   r   N)	r   r   r   r   r   Zselect_ranger   r   r   )r    r   r   r   r   r   r   Útest_paste_entry/   s    
zPasteTest.test_paste_entryc              	   C   s†   | j }dD ]v\}}| j||dP | dd¡ | dd¡ | dd|¡ | d¡ |  | ¡ |¡ W d  ƒ q
1 sv0    Y  q
dS )	z9Test pasting into a spinbox with and without a selection.r"   )r   r   r   r   r   Úranger   N)r   r   r   r   Z	selectionr   r   r   )r    r   r   r   r   r   r   Útest_paste_spin<   s    
zPasteTest.test_paste_spinN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úclassmethodr   r   r!   r#   r%   r   r   r   r   r      s   


r   Ú__main__é   )Ú	verbosity)r)   Ztest.supportr   Útkinterr   r   ZunittestZidlelibr   ZTestCaser   r&   Úmainr   r   r   r   Ú<module>   s   =