Current Dir: /snap/core22/2955/usr/lib/python3/dist-packages/urwid/tests/__pycache__/

[FILE] test_canvas.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_container.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_decoration.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_doctests.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_escapes.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_event_loops.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_graphics.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_listbox.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_str_util.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_text_layout.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_util.cpython-310.pyc [ edit | delete | rename ]
[FILE] test_widget.cpython-310.pyc [ edit | delete | rename ]
[FILE] util.cpython-310.pyc [ edit | delete | rename ]
[FILE] __init__.cpython-310.pyc [ edit | delete | rename ]

Viewing: /snap/core22/2955/usr/lib/python3/dist-packages/urwid/tests/__pycache__/test_listbox.cpython-310.pyc

o

��o_ym�@s�ddlZddlmZddlmZddlZGdd�dej�ZGdd�dej�ZGdd	�d	ej�Z	Gd
d�dej�Z
Gdd
�d
ej�ZdS)�N��B)�SelectableTextc@s$eZdZdd�Zdd�Zdd�ZdS)�ListBoxCalculateVisibleTestcCs�t�t�|��}|j�|�||_||_|jddd�\}	}
}|	\}}
}}}|dur5|\}}||7}||f}||ksBJd|||f��||ksOJd|||f��dS)N������focus�%s got: %r expected: %r� %s (cursor) got: %r expected: %r)�urwid�ListBox�SimpleListWalker�body�	set_focus�offset_rows�inset_fraction�calculate_visible)�self�descrrrr�exp_offset_inset�exp_cur�lbox�middle�top�bottom�offset_inset�focus_widget�	focus_pos�_ign�cursor�x�y�r%�:/usr/lib/python3/dist-packages/urwid/tests/test_listbox.py�cvtest	sz"ListBoxCalculateVisibleTest.cvtestc	Csztj}|d�|d�|d�|d�|d�|d�|d�g}|�d|ddddd�|�d|dd	dd	d�|�d
|ddddd�|�d|ddd
dd�|�d|ddddd�|�d|ddddd�|�d|ddddd�|�d|ddddd�|�d|ddddd�|�d|dd	ddd�|�d|ddd
d	d�|�d|d�|d�|d�gd	ddd	d�|�d|d�|d�|d�gd	ddd	d�dS)N��
�

zsimple top position�r�rr	zsimple middle positionr	zsimple bottom position�zstraddle top edge)r	r-���zstraddle bottom edgerzoff bottom edgerzway off bottom edge�dz
gap at topzgap at top and off bottom edgez
gap at bottom�z%gap at bottom and straddling top edgez$gap at bottom cannot completely fillzgap at top and bottom)r�Textr'�r�T�lr%r%r&�test1_simplesR.�������������z(ListBoxCalculateVisibleTest.test1_simplec	Cs�tjtj}}|d�|d�|d�|dd�|d�|d�|d�g}|d�|d�|d�|dd�|d�|d�|d�g}|d�d�|�d|ddd	dd
�|�d|ddd
dd
�|�d|ddddd
�|�d|ddd	dd�|�d|ddd	dd�dS)Nr(r)z

XzYY

r+r-zplain cursor in viewr	r,�r	r+zcursor off topr�r-rzcursor further off top�r-r+zcursor off bottom�r	rzcursor way off bottomr/)rr1�Edit�set_edit_posr')rr3�E�l1�l2r%r%r&�test2_cursorIs&00�����z(ListBoxCalculateVisibleTest.test2_cursorN)�__name__�
__module__�__qualname__r'r5r?r%r%r%r&rs-rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ListBoxChangeFocusTestcCs�t�t�|��}|�d|||||�||	f}|j|jf}
d}|j��\}}|��r3t	|d�r3|�
d�}|
|ks@Jd||
|f��||
ksMJd|||
f��dS)Nr�get_cursor_coords)rz%s got: %s expected: %sr
)rrr�change_focusrrr�	get_focus�
selectable�hasattrrD)rrr�posr�coming_fromr"�	snap_rows�exp_offset_rows�exp_inset_fractionrr�exp�actrr r%r%r&�cftestbs�

zListBoxChangeFocusTest.cftestcCs�tj}|d�|d�|d�|d�|d�g}|�d|dddddddd�
|�d|dddddddd�
|�d	|dd
dddddd�
|�d|d
ddddddd�
dS)Nr)r*zsimple unselectabler-rr,�unselectabler	zunselectable off top���r8zunselectable off bottomr+)rr1rPr2r%r%r&�test1unselectablexs"����z(ListBoxChangeFocusTest.test1unselectablecCstjt}}|d�|d�|d�|d�|d�g}|�d|dddddddd�
|�d|dddddddd�
|�d	|ddd
ddddd�
|�d|dddddddd�
|�d
|ddd
ddddd�
|�d|dddddddd�
|�d|dddddddd�
|�d|ddd
ddddd�
dS)Nr)r*zsimple selectabler-rr,rGr	zselectable at top�belowzselectable at bottom�abovezselectable off top snapr.zselectable off bottom snapr+zselectable off top no snapr6zselectable off bottom no snap�rr1rrP)rr3�Sr4r%r%r&�test2selectable�s4"��������z&ListBoxChangeFocusTest.test2selectablecCs8tjt}}|d�|d�|d�g}|�d|dddddddd�
|�d|dd	d
ddddd�
|�d|dd	d
dd
ddd�
|�d|dd	d
ddddd�
|�d|dddddddd�
|�d|ddddd
ddd�
|�d|dddddddd�
|d�|d�|d�g}|�d|dddddddd�
|�d|ddd
ddddd�
dS)Nr)z





zlarge selectable no snapr	r.r)r	�zlarge selectable snap uprRrTr,zlarge selectable snap up2r-zlarge selectable almost snap up)r-rYzlarge selectable snap downrUzlarge selectable snap down2z!large selectable almost snap down�



�




z"large selectable outside view downrz large selectable outside view up���)r	r0rV)rr3rWr4�mr%r%r&�test3large_selectable�s<���������z,ListBoxChangeFocusTest.test3large_selectablecCstjtj}}dS�N)rr1r:�rr3r<r%r%r&�test4cursor�sz"ListBoxChangeFocusTest.test4cursorcCs8tjtj}}t�t�|d�|d�g��}|�d�dS)Nr(r)rr1r:r�SimpleFocusListWalker�set_focus_valign)rr3r<rr%r%r&�test5set_focus_valign�s
�z,ListBoxChangeFocusTest.test5set_focus_valignN)	r@rArBrPrSrXr^rardr%r%r%r&rCasrCc@�4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�ListBoxRenderTestcCs�dd�|D�}t�t�|��}|j�|�|�d|�|jddd�}dd�|��D�}	|j}
|	|ks;Jd||	|f��|
|ksHJd	||
|f��dS)
NcSsg|]}t|��qSr%r)�.0�tr%r%r&�
<listcomp>�sz+ListBoxRenderTest.ltest.<locals>.<listcomp>�r�
rr	r
cSs"g|]
}t��dd�|D���qS)cSsg|]\}}}|�qSr%r%)rg�at�csrhr%r%r&ri�sz6ListBoxRenderTest.ltest.<locals>.<listcomp>.<listcomp>)�bytes�join)rg�lnr%r%r&ri�s"z%s (text) got: %r expected: %rr
)	rrrrr�shift_focus�render�contentr")rrrr�offset_inset_rows�exp_textrr�canvas�textr"r%r%r&�ltest�szListBoxRenderTest.ltestc	Cs�tj}|�d|d�gddgd�d�|�d|d�|d�|d�|d	�|d
�gddgd�d�|�d
|d�|d�|d�|d	�|d
�gddgd�d�dS)Nzsimple one text item render�1
2r)�1   �2   �    r|r|z(simple multi text item render off bottom�1�2�3
4�5�6r-�rzr{�3   �4   �5   z%simple multi text item render off topr	�r{r�r�r��6   �rr1rx�rr3r%r%r&r5�s�$�$�zListBoxRenderTest.test1_simplecCs�tj}|�d|d�|d�|d�gddgd�d�|�d|d�|d�|d�gddgd	�d�|�d
|d�gddgd�d�|�d
|d�gddgd�d�|�d|d�gddgd	�d�|�d|d�gddgd	�d�dS)Nztrim unfocused bottomryr�5
6r	r-r�ztrim unfocused topr�ztrim none full focusz	1
2
3
4
5rztrim focus bottomz1
2
3
4
5
6ztrim focus topr.ztrim focus top and bottomz
1
2
3
4
5
6
7r�r�r%r%r&�
test2_trim�s2������zListBoxRenderTest.test2_trimc	Cs.tjtj}}|�d|d�|d�|d�|d�|d�gddgd	�d�|d
dd�}|�d
�|�d||d�|d�|d�gddgd�d�|�d|d�|d�|d�|d
d�gddgd�d�|�d|d
d�|d�|d�|d�gddgd�d�|d
d�}|�d�|�d|d�|d�|d�|gddgd�d �dS)!Nzshift up one fitry�3�4r�r�rrr�r(zab
cr	r-zshift down one cursor over edger�rr.)zab  zc   r�r�r�r7zshift up one cursor over edgezd
er+)r{r�r�zd   ze   r9z%shift none cursor top focus over edgezab
)r|r�r�r�r��rrzabc
dz(shift none cursor bottom focus over edge)rzr{r�r�zabc �r+r)rr1r:rxr;)rr3r<�er%r%r&�test3_shift	s2$�
� � �

�zListBoxRenderTest.test3_shiftcCsPtjtj}}|�d|d�gddgd�d�|�d|dd�gddgd�d�dS)Nzreally large edit��hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellor)�hell�ohel�lohe�lloh�ellor()r�r�r�r�zllo r�)rr1r:rxr`r%r%r&�test4_really_large_contents$s��z-ListBoxRenderTest.test4_really_large_contentsN)r@rArBrxr5r�r�r�r%r%r%r&rf�srfc@s8eZdZ	ddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�ListBoxKeypressTestNc
Cs�|	durt�t�|��}	|	j�|�|	�d|�|	�d|�}
|	jddd�\}}}
|\}}}}}|dur?|\}}||7}||f}||f}||f}||ksTJd|||f��||ksaJd|||f��|
|	fS)Nrjrr	r
rr
)rrrrrrq�keypressr)rr�keyrrr�	exp_focusrrr�ret_keyrrrrr r!r"r#r$rNrOr%r%r&�ktest0s zListBoxKeypressTest.ktestcCs"tjttj}}}|�dd|d�|d�gddddd�|�dd|d�|d�|d�gddddd�|�dd|d�gddddd�\}}|dksHJ�|�d	d|d�|d�|d�gddddd�\}}|dkseJ�|�d
d|d�|d�|d�gddddd�|�dd|d�|d�|d�gddddd�|�d
d|d�|d�|d�|d�gddddd�|�dd|d�|d�|d�|d�gddddd�|�dd|d�|d�|d�|d�gddddd�|�dd|d�|d�|d�|d�gddddd�|�dd|d�|d�gddddd�|�dd|dd�|dd�gddddd�|�dd|dd�|d�|dd�gddddd�\}}|�dddddddd|�	|�dd|d�|dd�gdd ddd�|�d!d|d�|dd�gdd ddd�|�d"d|d�|d�gddddd�|�d#d|d�|dd$�gddddd�|�d%d|d�|d�|d�|d�|d�|d�|d�gddddd�|�d&d|d�|d'�|d�|d�|d�|d�gddddd�|�d(d|dd)�|dd$�|dd*�gddddd+�\}}|�d,ddddddd-|�	|dd�}|�d�|�d.d|gddddd/�\}}|jddk�sJ�dS)0N�direct selectable both visible�upr(r	r�selectable skip one all visibler-znothing above no scrollzunselectable above no scrollzunselectable above scroll 1�


zselectable above scroll 1zselectable above too farz selectable above skip 1 scroll 1ztall selectable above scroll 2r)z#very tall selectable above scroll 5rZ�"very tall selected scroll within 1r[r.zedit above pass cursor�abc�der7z edit too far above pass cursor Arz edit too far above pass cursor B�$within focus cursor made not visible�hi
�abr+�(within focus cursor made not visible (2)�force focus unselectable�pathological cursor widget�a�unselectable to unselectable�unselectable over edge to same�12
34� edit short between pass cursor A�abcd�def�r	r	� edit short between pass cursor B)r+r�edit cursor force scrollr�)rr1rr:r�r;r)rr3rWr<r�rr�r%r%r&�test1_upHs�������������������0�*���

�zListBoxKeypressTest.test1_upcCs8tjttj}}}|�dd|d�|d�gddddd�|�dd|d�|d�|d�gddddd�|�dd|d�gddddd�\}}|dksHJ�|�d	d|d�|d�|d�gddddd�\}}|dkseJ�|�d
d|d�|d�|d�gdddd
d�|�dd|d�|d�|d�gddddd�|�dd|d�|d�|d�|d�gdddd
d�|�dd|d�|d�|d�|d�gdd
d
dd�|�dd|d�|d�|d�|d�gdddd
d�|�dd|d�|d�|d�|d�gddddd�|�dd|d�|d�gddddd�|�dd|dd�|dd�gddddd�|�dd|dd�|d�|dd�gddddd�\}}|�dddddddd|�	|dd�}|�d�d d!�|_|�d"d||d�gddddd�|�d#d||d�gddddd�|�d$d|d�|d�gddddd�|�d%�|�d&d||d�gddddd�|�d'd|d�|d�|d�|d�|d�|d�|d�gddd(dd�|�d)d|d�|d�|d�|d�|d*�|d�gdddd
d�|�d+d|dd�|dd,�|dd-�gddddd.�\}}|�d/ddddddd0|�	|dd�}|�d�|�d1d|gddddd2�\}}|jddk�sJ�dS)3Nr��downr(rr	r�r-znothing below no scrollzunselectable below no scrollzunselectable below scroll 1r�rr+zselectable below scroll 1zselectable below too farz selectable below skip 1 scroll 1ztall selectable below scroll 2r)z#very tall selectable below scroll 5rZr�r[r.zedit below pass cursorr�r��r-r	z edit too far below pass cursor Az edit too far below pass cursor B)r-r�hi
abcS�dS�Nrr%��s�c�xyr%r%r&�<lambda>��z0ListBoxKeypressTest.test2_down.<locals>.<lambda>r�r�r�zhi




r�r�rr�r�r�r��defgr�r�)r+r-r��rr)	rr1rr:r�r;�move_cursor_to_coords�
set_edit_textr)rr3rWr<r�r�odd_er�r%r%r&�
test2_down�s���������������


���
�0�*���

�zListBoxKeypressTest.test2_downc
Cs�tjttj}}}|�dd|d�|d�|d�|d�|d�|d�gddddd�|�d	d|d�|d�|d�|d�|d�|d�gdd
ddd�|�dd|d�|d�|d�|d�|d�|d�gdddd
d�|�d
d|d�|d�|d�|d�|d�gdddd
d�|�dd|d�|d�|d�|d�|d�gddddd�|�dd|d�|d�|d�gdddd
d�|dd�}|�d�|�dd|d�||d�gddddd�|�dd|d�|dd�|d�gddddd�|dd�}|�d�|�dd|d�||d�gddddd�|�dd|d�|d�|d�|d�|d�|d�gd dddd�|�d!d|d�|d�|d�|d�|d�|d�gd dddd�|�d"d|d�|d�|d�|d�|d�|d�|d�|d�gd#d$ddd�|�d%d|d�|d�|d�|d�|d�|d�|d�|d�gd#d$ddd�|�d&d|d�|d�|d�|d�|d�|d�|d�|d�gd#d$d$dd�|�d'd|d�|d�|dd(�|d�|d�gd$dd$dd)�|�d*d|d�|d�|dd�|d�|d�gd$dddd�|dd+�}|�d$�d,d-�|_|�d.d||d�|d�|d�|d�|d�gdd$dd
d�|�d/d|d�|d�|d�|d�|d�|d�gdd$d$dd�|�d0d|d�|d�|d�|d�|d�|d�gdd$dd
d�|�d1d|d�|d�|d�gddddd�|�d2d|d3�|d�gddddd�|�d4d|d�|d5�gddddd�|�d6d|d�|d3�|d7�|d8�gddddd�|�d9d|d7�|d:�|d:�|d8�|d;�|d:�gddddd�|�d<d|d7�|d:�|d:�|d8�|d;�|d:�gddddd�dS)=N�unselectable aligned to aligned�page upr(r)r*r+rr	�!unselectable unaligned to alignedr.�selectable to unselectabler� selectable to cut off selectable�seletable to selectable�within very long selectable�







i����z

ab




cd
��within very long cursor widgetrRr7r�r�r\�
ab




cd
rk�very long cursor widget snapr��slight scroll selectabler�r�scroll into snap region�mid scroll shortr0r-�mid scroll long�mid scroll perfect�cursor move up fail shortz
abr��cursor force fail shortr�cSr�r�r%r�r%r%r&r�_r�z3ListBoxKeypressTest.test3_page_up.<locals>.<lambda>�cursor force fail long�prefer not cut off�
allow cut offzat top fail�all visible failr��current ok fail�hiz!all visible choose top selectable�br�zbring in edge choose top�-�dz#bring in edge choose top selectable�rr1rr:r�r;r��rr3rWr<r�r�r%r%r&�
test3_page_ups�*�*�*�$�$��

��

�*�*�2
�2
�2
�&�&�


&�*�*�����*�*�z!ListBoxKeypressTest.test3_page_upc
Cs�tjttj}}}|�dd|d�|d�|d�|d�|d�|d�gddddd�|�d	d|d�|d�|d�|d�|d�|d�gddddd�|�d
d|d�|d�|d�|d�|d�|d�gddddd�|�dd|d�|d�|d�|d�|d�gddddd�|�d
d|d�|d�|d�|d�|d�gddddd�|�dd|d�|d�|d�gddddd�|dd�}|�d�|�dd|d�||d�gddddd�|dd�}|�d�dd�|_|�dd|d�||d�gddddd�|dd�}|�d�|�dd|d�||d�gddddd�|�dd|d�|d�|d�|d�|d�|d�gddddd�|�dd|d�|d�|d�|d�|d�|d�gddddd�|�d d|d�|d�|d�|d�|d�|d�|d�|d�gddddd�|�d!d|d�|d�|d�|d�|d�|d�|d�|d�gddd"dd�|�d#d|d�|d�|d�|d�|d�|d�|d�|d�gddd$dd�|dd%�}|�d�|�d&d|d�|d�||d�|d�gdddd'd(�|dd%�}|�d�d)d�|_|�d*d|d�|d�||d�|d�gddddd�|�d+d|d�|d�|d�|d�|d�|d,d-�gddddd�|�d.d|d�|d�|d�|d�|d�|d�gddddd�|�d/d|d�|d�|d�|d�|d�|d�gddd$dd�|�d0d|d�|d�|d�gddddd�|�d1d|d2�|d�gddddd�|�d3d|d4�|d�gddddd�|�d5d|d2�|d6�|d7�|d�gddddd�|�d8d|d9�|d:�|d7�|d9�|d9�|d6�gddd$dd�|�d;d|d9�|d:�|d7�|d9�|d9�|d6�gddddd�dS)<Nr��	page downr*r)r(r-rr+r�r�r	r�r�r�r����z
ab




cd

r�rRr9zab








cSr�r�r%r�r%r%r&r��r�z5ListBoxKeypressTest.test4_page_down.<locals>.<lambda>r�r�r�r6r�r�rr�r�r�r0r�rr�r�r.)r	rcSr�r�r%r�r%r%r&r��r�r�r�r�r�r�r�zat bottom failr�r�r�r�z"all visible choose last selectabler�r�zbring in edge choose lastr�r�z$bring in edge choose last selectabler�r�r%r%r&�test4_page_down�s�*�*�*�$�$��

�


�

�*�*�2
�2
�2
�

 �


 �(
�*�*�����*�*�z#ListBoxKeypressTest.test4_page_downr_)r@rArBr�r�r�r�r�r%r%r%r&r�/s
�dior�c@re)�ZeroHeightContentsTestcCs*t�t�t�g�g��}|jddd�dS)N��(rkTr
)rrr�Pilerr�r�lbr%r%r&�test_listbox_pile�s
�z(ZeroHeightContentsTest.test_listbox_pilecCsdt�t�t�d�t�g�g��}|�dd�|�|��dd�|�dd�|�|��dd�dS)NrUr�r�r	r)rrrr1r�r��assertEqualrFr�r%r%r&� test_listbox_text_pile_page_downs�z7ZeroHeightContentsTest.test_listbox_text_pile_page_downcCsnt�t�t�g�t�d�g��}|�d�|�dd�|�|��dd�|�dd�|�|��dd�dS)NrTr	r�r�)	rrrr�r1rr�r�rFr�r%r%r&�test_listbox_text_pile_page_up	s�
z5ZeroHeightContentsTest.test_listbox_text_pile_page_upcCsrt�g�}dd�|_t�t�t�d�|g��}|�dd�|�|��dd�|�dd�|�|��dd�dS)NcSr��NTr%r%r%r%r&r�r�zDZeroHeightContentsTest.test_listbox_text_pile_down.<locals>.<lambda>rUr�r�r	r)	rr�rGrrr1r�r�rF�r�spr�r%r%r&�test_listbox_text_pile_downs

z2ZeroHeightContentsTest.test_listbox_text_pile_downcCs|t�g�}dd�|_t�t�|t�d�g��}|�d�|�dd�|�|�	�dd�|�dd�|�|�	�dd�dS)NcSr�r�r%r%r%r%r&r�r�zBZeroHeightContentsTest.test_listbox_text_pile_up.<locals>.<lambda>rTr	r�r�)
rr�rGrrr1rr�r�rFr�r%r%r&�test_listbox_text_pile_ups


z0ZeroHeightContentsTest.test_listbox_text_pile_upN)r@rArBr�r�r�r�r�r%r%r%r&r��s		r�)�unittest�urwid.compatr�urwid.tests.utilrr�TestCaserrCrfr�r�r%r%r%r&�<module>sYn`O
Upload File: