3
ข fx# ใ @ sx d Z ddlmZ ddlZddlmZ ddlmZmZ ddl m
Z
G dd dZG d d
d
ejZ
edkrtejdd
dS )zTest hyperparser, coverage 98%.้ )ฺHyperParserN)ฺrequires)ฺTkฺText)ฺEditorWindowc @ s e Zd Zdd ZejZejZdS )ฺDummyEditwinc C s" || _ d| _d| _d| _d| _d S )N้ T้2 ้๔ ้่ )r r
r )ฺtextZindentwidthZtabwidthฺcontext_use_ps1Znum_context_lines)ฺselfr ฉ r ๚G/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_hyperparser.pyฺ__init__
s
zDummyEditwin.__init__N)ฺ__name__ฺ
__module__ฺ__qualname__r r Z_build_char_in_string_funcZis_char_in_stringr r r r r s r c @ sx e Zd ZdZedd Zedd Zdd Zdd Zd
d Z dd
Z
dd Zdd Zdd Z
dd Zdd Zdd ZdS )ฺHyperParserTestu# """This is a module docstring"""
# this line is a comment
x = "this is a string"
y = 'this is also a string'
l = [i for i in range(10)]
m = [py*py for # comment
py in l]
x.__len__
z = ((r'asdf')+('a')))
[x for x in
for = False
clichรฉ = "this is a string with unicode, what a clichรฉ"c C s6 t d t | _| jj t| j| _t| j| _d S )NZgui)r r ฺrootZwithdrawr r r ฺeditwin)ฺclsr r r ฺ
setUpClass% s
zHyperParserTest.setUpClassc C s | ` | `| jj | `d S )N)r r r Zdestroy)r r r r ฺ
tearDownClass- s
zHyperParserTest.tearDownClassc C s | j jd| j d S )Nฺinsert)r r ฺcode)r r r r ฺsetUp3 s zHyperParserTest.setUpc C s | j jdd d| j_d S )Nz1.0ฺendT)r ฺdeleter r
)r r r r ฺtearDown6 s zHyperParserTest.tearDownc C s t | j|S )z>
Return a parser object with index at 'index'
)r r )r ฺindexr r r ฺ
get_parser: s zHyperParserTest.get_parserc C s | j t }| jjddd | jd}W dQ R X | jdt|j d| j_ | jd}| j
|j| jjdd | jj
d| jjddd | jd
}dS )z6
test corner cases in the init method
Zconsolez1.0z1.endz1.5NZprecedesFr ้ z54.5)ฺassertRaisesฺ
ValueErrorr Ztag_addr" ฺassertInฺstrฺ exceptionr r
ฺassertEqualZrawtextฺgetr )r ฺveฺpr r r ฺ test_init@ s
zHyperParserTest.test_initc C sค | j }|d}| j|j |d}| j|j |d}| j|j |d}| j|j |d}| j|j |d}| j|j |d}| j|j d S )Nz1.0z1.4z2.3z3.3z3.7z4.6z12.54)r" ฺassertFalseZis_in_stringฺ
assertTrue)r r* r, r r r ฺtest_is_in_stringT s z!HyperParserTest.test_is_in_stringc C s | j }|d}| j|j |d}| j|j |d}| j|j |d}| j|j |d}| j|j |d}| j|j d S )Nz1.0z1.1z2.5z3.4z3.6z4.14)r" r/ Z
is_in_coder. )r r* r, r r r ฺtest_is_in_codef s zHyperParserTest.test_is_in_codec C sเ | j }dd }dd }|d}| j|| | j|| |d}| j||d | j|||| |d }| j||d | j|||| |d}| j||d | j|| |d}| j|| | j|| d S )Nc S s | j ddS )NF)ฺ mustclose)ฺget_surrounding_brackets)ฺparserr r r ฺwithout_mustclosey s zGHyperParserTest.test_get_surrounding_bracket.