OwlCyberSecurity - MANAGER
Edit File: test_formatparagraph.cpython-35.opt-1.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>���r���r���r���r ���r���(���s ��� 6r���c���������������@���s"���e��Z�d��Z�d�Z�d�d����Z�d�S)�ReformatFunctionTestz?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)Nz O hello world� r ���zHello world����zHello worldz O hello world��������z O hello world����� ���z O hello worldz O hello worldz O hello world)r���r ���Zreformat_paragraph)r���r���ZreformZhwr���r���r ����test_reformat_paragraph����s ���� z,ReformatFunctionTest.test_reformat_paragraphN)r���r���r���r���rG���r���r���r���r ���r@�������s���r@���c���������������@���s"���e��Z�d��Z�d�Z�d�d����Z�d�S)�ReformatCommentTestz=Test the reformat_comment function without the editor window.c�������������C���si���|��j��}�d�}�t�j�|�d�d���}�d�}�|�|�|���d�}�t�j�|�d�d���}�d�}�|�|�|���d��S)Nzu """this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?"""r1���z zy """this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?"""zm# this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?r���zo# this is a test of a reformat for a triple quoted string will it # reformat to less than 70 characters for me?)r���r ���Zreformat_comment)r���r����test_string�resultr*���r ���r���r���r ����test_reformat_comment����s���� z)ReformatCommentTest.test_reformat_commentN)r���r���r���r���rK���r���r���r���r ���rH�������s���rH���c���������������@���s���e��Z�d��Z�d�d����Z�d�S)�FormatClassTestc�������������C���sC���t��j�d���}�|��j�|�j�d���|�j����|��j�|�j�d����d��S)N�editor)r ���r���r���Zeditwin�close)r����instancer���r���r ����test_init_close����s���� zFormatClassTest.test_init_closeN)r���r���r���rP���r���r���r���r ���rL�������s���rL���c���������������@���s@���e��Z�d��Z�d�d����Z�d�d����Z�d�d����Z�d�d����Z�d �S) �TextWrapperc�������������C���s���t��d�|���|��_�d��S)N�master)r���r���)r���rR���r���r���r ����__init__����s����zTextWrapper.__init__c�������������C���s���t��|��j�|���S)N)�getattrr���)r����namer���r���r ����__getattr__����s����zTextWrapper.__getattr__c�������������C���s���d��S)Nr���)r���r���r���r ����undo_block_start����s����zTextWrapper.undo_block_startc�������������C���s���d��S)Nr���)r���r���r���r ����undo_block_stop����s����zTextWrapper.undo_block_stopN)r���r���r���rS���rV���rW���rX���r���r���r���r ���rQ�������s���rQ���c���������������@���s%���e��Z�d��Z�d�d����Z�e�j�Z�d�S)�Editorc�������������C���s���t��|���|��_�d��S)N)rQ���r���)r����rootr���r���r ���rS�������s����zEditor.__init__N)r���r���r���rS���r���Zget_selection_indicesr���r���r���r ���rY�������s���rY���c���������������@���s|���e��Z�d��Z�d�Z�d�Z�d�Z�d�Z�e�d�d������Z�e�d�d������Z �d �d ����Z �d�d����Z�d �d����Z�d�d����Z �d�S)�FormatEventTestz�Test the formatting of text inside a Text widget. This is done with FormatParagraph.format.paragraph_event, which calls functions in the module as appropriate. zv '''this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?''' a�� '''The first line is under the max width. The second line's length is way over the max width. It goes on and on until it is over 100 characters long. Same thing with the third line. It is also way over the max width, but FormatParagraph will fix it. ''' a,��# The first line is under the max width. # The second line's length is way over the max width. It goes on and on until it is over 100 characters long. # Same thing with the third line. It is also way over the max width, but FormatParagraph will fix it. # The fourth line is short like the first line.c�������������C���sP���t��d���t����|��_�t�d�|��j���}�|�j�j�|��_�t�j�|���j�|��_�d��S)NZguirZ���) r���r���rZ���rY���r���r ���r���Zformat_paragraph_event� formatter)r���rM���r���r���r ���r�����s ���� zFormatEventTest.setUpClassc�������������C���s#���|��`��|��`�|��j�j����|��`�d��S)N)r���r\���rZ���Zdestroy)r���r���r���r ���� tearDownClass��s���� zFormatEventTest.tearDownClassc�������������C���sV���|��j��j�d�d���|��j�d���|��j�|��j��j�d�d���d���|��j��j�d�d���d��S)Nz1.0zShort line ZDummyr$���r#���)r���r$���r\���r����getr)���)r���r���r���r ����test_short_line��s���� zFormatEventTest.test_short_linec�������������C���s����|��j��}�|�j�d�|��j���|�j�d�d���|��j�d�d�d��|�j�d�d���}�d�}�|��j�|�|���|�j�d�d���|�j�d�|��j���|�j�d�d �d ���|��j�d�d�d��|�j�d�d���}�d�}�|��j�|�|���|�j�d�d���d��S)Nz1.0r$����ParameterDoesNothing�limitr1���zz '''this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?''' r#����selz1.11z1.endzv '''this is a test of a reformat for a triple quoted string will it reformat to less than 70 characters for me?''') r���r$���rI���Zmark_setr\���r^���r���r)����tag_add)r���r���rJ���r*���r���r���r ����test_long_line!��s���� zFormatEventTest.test_long_linec�������������C���s~���|��j��}�|�j�d�|��j���|�j�d�d�d���|��j�d�d�d��|�j�d�d���}�d �}�|��j�|�|���|�j�d�d ���d��S)Nz1.0rb���z2.0z4.0r`���ra���r1���r$���z� The second line's length is way over the max width. It goes on and on until it is over 100 characters long. Same thing with the third line. It is also way over the max width, but FormatParagraph will fix it. r#���)r���r$����multiline_test_stringrc���r\���r^���r���r)���)r���r���rJ���r*���r���r���r ����test_multiple_lines<��s���� z#FormatEventTest.test_multiple_linesc�������������C���s����|��j��}�|�j�d�|��j���|��j�d�d�d��|�j�d�d���}�d�}�|��j�|�|���|�j�d�d���|�j�d�|��j���|�j�d�d �d ���|��j�d�d�d��|�j�d�d���}�d�}�|��j�|�|���|�j�d�d���d��S)Nz1.0r`���ra���r1���r$���a/��# The first line is under the max width. The second line's length is # way over the max width. It goes on and on until it is over 100 # characters long. Same thing with the third line. It is also way over # the max width, but FormatParagraph will fix it. The fourth line is # short like the first line. r#���rb���z2.0z3.0z�# The first line is under the max width. # The second line's length is way over the max width. It goes on and # on until it is over 100 characters long. )r���r$����multiline_test_commentr\���r^���r���r)���rc���)r���r���rJ���r*���r���r���r ����test_comment_blockK��s���� z"FormatEventTest.test_comment_blockN)r���r���r���r���rI���re���rg���r?���r���r]���r_���rd���rf���rh���r���r���r���r ���r[�������s��� r[����__main__� verbosityr"����exit)ZunittestZidlelibr���r ���Zidlelib.EditorWindowr���Ztkinterr���r���Ztest.supportr���ZTestCaser���r���r@���rH���rL���rQ���rY���r[���r����mainr���r���r���r ����<module>���s���w�