B
NjxN @ s d Z ddlmZ ddlmZmZ ddlZddlmZm Z m
Z
mZmZ ddl
mZ ddlmZ ddlmZmZmZ dd lmZ dd
lmZ ddlmZ ddlmZ ejZd
d ZG dd dejZ G dd dejZ!G dd dejZ"e#dkrej$dd dS )zTest squeezer, coverage 95% )dedent)TextTkN)MockNonCallableMagicMockpatchsentinelANY)requires)idleConf)count_lines_with_wrappingExpandingButtonSqueezer)macosx) view_text)Hovertip)PyShellc s0 t d t fdd}| | S )z*Helper for tests: Create a root Tk object.Zguic s d S )N)Zupdate_idletasksZdestroy )rootr D/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_squeezer.pycleanup_root s z&get_test_tk_root.<locals>.cleanup_root)r
r Zwithdraw
addCleanup)Z
test_instancer r )r r get_test_tk_root s
r c @ sP e Zd ZdZdd Zdd Zdd Zdd Zd
d Zdd
Z dd Z
dd ZdS )CountLinesTestz1Tests for the count_lines_with_wrapping function.c C s | |t||S )N)assertEqualr )selfexpectedtext linewidthr r r check% s zCountLinesTest.checkc C s | tdd dS )zTest with an empty string. r N)r r )r r r r test_count_empty+ s zCountLinesTest.test_count_emptyc C s | tdd dS )z/Test with a string which begins with a newline.z
text N)r r )r r r r !test_count_begins_with_empty_line/ s z0CountLinesTest.test_count_begins_with_empty_linec C s | tdd dS )z-Test with a string which ends with a newline.ztext
N)r r )r r r r test_count_ends_with_empty_line3 s z.CountLinesTest.test_count_ends_with_empty_linec C s | tdd dS )z Test with several lines of text.z1
2
3
N)r r )r r r r test_count_several_lines7 s z'CountLinesTest.test_count_several_linesc C s4 | j dddd | j dddd | j dddd d S ) Nr$
P )r r r r"