Viewing File: /opt/alt/python35/lib64/python3.5/idlelib/idle_test/__pycache__/test_formatparagraph.cpython-35.pyc
©ÕYfû7 ã @ s4 d d l Z d d l m Z d d l m Z d d l m Z m Z d d l m
Z
Gd d „ d e j ƒ Z Gd d „ d e j ƒ Z
Gd
d „ d e j ƒ Z Gd d
„ d
e j ƒ Z Gd d „ d e j ƒ Z Gd d „ d ƒ Z Gd d „ d ƒ Z Gd d „ d e j ƒ Z e d k r0e j d d d d ƒ d S)é N)ÚFormatParagraph)ÚEditorWindow)ÚTkÚText)Úrequiresc @ sX e Z d Z d Z d Z d Z d Z d Z d Z d d „ Z d d
„ Z
d d „ Z d
S)ÚIs_Get_TestzTest the is_ and get_ functionsz# This is a commentzThis is not a commentz# This is a comment z # This is a commentz This is not a commentc C sI | j t j d ƒ ƒ | j t j d ƒ ƒ | j t j | j ƒ ƒ d S)NÚ z
)Z
assertTrueÚfpZis_all_whiteZassertFalseÚtest_comment)Úself© r úK/opt/alt/python35/lib64/python3.5/idlelib/idle_test/test_formatparagraph.pyÚtest_is_all_white s zIs_Get_Test.test_is_all_whitec C sq | j } | t j | j ƒ d ƒ | t j | j ƒ d ƒ | t j | j ƒ d ƒ | t j | j ƒ d ƒ d S)Nr z )ÚassertEqualr Z
get_indentr
Útrailingws_commentÚleadingws_commentÚleadingws_nocomment)r ÚEqualr r r
Útest_get_indent s
zIs_Get_Test.test_get_indentc C sŠ | j } | t j | j ƒ d ƒ | t j | j ƒ d ƒ | t j | j ƒ d ƒ | t j | j ƒ d ƒ | t j | j ƒ d ƒ d S)Nú#z #z r )r r Zget_comment_headerr
r r r Útest_nocomment)r r r r r
Útest_get_comment_header s z#Is_Get_Test.test_get_comment_headerN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
r r r r r r r r r r r
r s r c @ sL e Z d Z d Z e d d „ ƒ Z d d „ Z d d „ Z d d „ Z d
S)ÚFindTesta` Test the find_paragraph function in FormatParagraph.
Using the runcase() function, find_paragraph() is called with 'mark' set at
multiple indexes before and inside the test paragraph.
It appears that code with the same indentation as a quoted string is grouped
as part of the same paragraph, which is probably incorrect behavior.
c C s d d l m } | ƒ | _ d S)Nr )r )Zidlelib.idle_test.mock_tkr Útext)Úclsr r r r
Ú
setUpClass2 s zFindTest.setUpClassc C s· | j } | j d | ƒ x‡ t d | ƒ D]v } t | j d | ƒ j d ƒ d ƒ } xG d | d | f D]2 } d | | f } | j t j | | ƒ | ƒ qi Wq) W| j d d ƒ d S) Nz1.0é z%d.endÚ.r é z%d.%dÚend)
r ÚinsertÚrangeÚintÚindexÚsplitr r Zfind_paragraphÚdelete) r Z
inserttextZstoplineÚexpectedr ÚlineZ
linelengthÚcolZ tempindexr r r
Úruncase7 s &$zFindTest.runcasec C s| d } | j | d d d d | d d … f ƒ d } | j | d d
d d | d d
… f ƒ d } | j | d d
d d | d d … f ƒ d } | j | d d
d d | d d … f ƒ d } | j | d d
d d | d d … f ƒ d } | j | d d
d d | d d … f ƒ d } | j | d d
d d | d d … f ƒ d } | j | d d
d d | d d … f ƒ d S)Nz;# Comment block with no blank lines before
# Comment line
é z1.0z3.0r r é: zG
# Comment block with whitespace line before and after
# Comment line
é z2.0z4.0r éF zS
# Indented comment block with whitespace before and after
# Comment line
z #éR z
# Single line comment
é z4
# Single line comment with leading whitespace
é3 z0
# Comment immediately followed by code
x = 42
é( z=
# Indented comment immediately followed by code
x = 42
é5 z=
# Comment immediately followed by indented code
x = 42
é1 )r- )r Zcommentr r r
Útest_find_commentD s )))))))zFindTest.test_find_commentc C sï d } | j | d d d d | d d … f ƒ d } | j | d d
d d | d d
… f ƒ d } | j | d d
d d | d d … f ƒ d } | j | d d
d d | d d … f ƒ d } | j | d d
d d | d d … f ƒ d S)Nz6"""String with no blank lines before
String line
"""
r0 z1.0z4.0r r r6 zC
"""String with whitespace line before and after
String line.
"""
é z2.0z5.0r éB zV
"""Indented string with whitespace before and after
Comment string.
"""
z éU z
"""Single line string."""
r. z3.0é z8
"""Single line string with leading whitespace."""
é7 )r- )r Z
teststringr r r
Útest_find_paragraphz s ))))zFindTest.test_find_paragraphN) r r r r Úclassmethodr r- r8 r>