| Server IP : 66.29.146.62 / Your IP : 216.73.216.152 Web Server : LiteSpeed System : Linux premium231.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64 User : dokkdzvi ( 925) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python35/lib64/python3.5/idlelib/idle_test/__pycache__/ |
Upload File : |
��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>