ok
Direktori : /opt/alt/python27/lib64/python2.7/idlelib/idle_test/ |
Current File : //opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyo |
� �[ bc @ s7 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 d e j f d � � YZ d e j f d � � YZ d e j f d � � YZ d e j f d � � YZ d e j f d � � YZ d d d � � YZ d d d � � YZ d e j f d � � YZ e d k r3e j d d d d � n d S( i����N( t FormatParagraph( t EditorWindow( t Tkt Text( t requirest Is_Get_Testc B sG e Z d Z d Z d Z d Z d Z d Z d � Z d � Z d � Z RS( s Test the is_ and get_ functionss # This is a comments This is not a comments # This is a comment s # This is a comments This is not a commentc C sI | j t j d � � | j t j d � � | j t j | j � � d S( Nt s ( t assertTruet fpt is_all_whitet assertFalset test_comment( t self( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt test_is_all_white s c C sq | j } | t j | j � d � | t j | j � d � | t j | j � d � | t j | j � d � d S( NR s ( t assertEqualR t get_indentR t trailingws_commentt leadingws_commentt leadingws_nocomment( R t Equal( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt test_get_indent s c 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( Nt #s #s R ( R R t get_comment_headerR R R R t test_nocomment( R R ( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt test_get_comment_header s ( t __name__t __module__t __doc__R R R R R R R R ( ( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyR s t FindTestc B s8 e Z d Z e d � � Z d � Z d � Z d � Z RS( s` 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( Ni����( R ( t idlelib.idle_test.mock_tkR t text( t clsR ( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt setUpClass2 s c 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( Ns 1.0i s %d.endt .i i s %d.%dt end( R t insertt ranget intt indext splitR R t find_paragrapht delete( R t inserttextt stoplinet expectedR t linet linelengtht colt tempindex( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt runcase7 s &$c C sd 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( Ns; # Comment block with no blank lines before # Comment line i s 1.0s 3.0R i i: sG # Comment block with whitespace line before and after # Comment line i s 2.0s 4.0i iF sS # Indented comment block with whitespace before and after # Comment line s #iR s # Single line comment i s4 # Single line comment with leading whitespace i3 s0 # Comment immediately followed by code x = 42 i( s= # Indented comment immediately followed by code x = 42 i5 s= # Comment immediately followed by indented code x = 42 i1 ( R1 ( R t comment( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt test_find_commentD s &&&&&&&c 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( Ns6 """String with no blank lines before String line """ i s 1.0s 4.0R i i5 sC """String with whitespace line before and after String line. """ i s 2.0s 5.0i iB sV """Indented string with whitespace before and after Comment string. """ s iU s """Single line string.""" i s 3.0i s8 """Single line string with leading whitespace.""" i7 ( R1 ( R t teststring( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt test_find_paragraphz s &&&&( R R R t classmethodR R1 R3 R5 ( ( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyR ( s 6t ReformatFunctionTestc B s e Z d Z d � Z RS( s? Test the reformat_paragraph function without the editor window.c C s* | j } t j } d } | | d d � d � | | d d � d � | | | d � d � | | | d � d � | | | d � d � | | | d � d � | | | d � d � d } | | | d � d � | | | d � d � | | | d � d � | | | d � d � | | | d � d � d S( Ns O hello worldt i s Hello worldi s Hello worlds O hello worldi i s O hello worldi i s O hello worlds O hello worlds O hello world( R R t reformat_paragraph( R R t reformt hw( ( sK /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_formatparagraph.pyt test_reformat_paragraph� s ( R R R R<