[issue18226] IDLE Unit test for FormatParagrah.py

Phil Webster report at bugs.python.org
Wed Jul 17 12:25:28 CEST 2013


Phil Webster added the comment:

Added tests for FormatParagraph using single/multiline comment blocks and single/multiline strings in the mock editor window.

Here is a summary of the changes:

FormatParagraph.py
- description for format_paragraph_event
- modified so that selecting a long comment line will comment the new wrapped line
- if __name__ == __main__"...

mock_tk.py
- FormatParagraph uses the 'insert' tag, so I implemented tag_add using a dict (not sure if this is the best option...)
- index returns '' if the index refers to selection that doesn't exist (this replicates the real Text widget). It does this by excepting a TypeError and I'm guessing there is a better way to do it than this.
- tags (i.e. 'sel.first') can be set to 'end' or other indexes which would not work with a regular Text widget, but it may be useful here.

mock_idle.py
- added undo start/stop for the mock text widget
- used 'sel.first' and 'sel.last' for get_selection_indices()

test_rstrip.py
- This test used the 'insert' tag, so I set 'insert' to an index to keep the tests passing.

test_text.py
- Same issue with 'insert' as test_rstrip

Should I be submitting multiple patches for these changes or is it ok to combine them? I was also wondering if it would be a good idea to split up the FormatParagraph tests into separate tests.

----------
Added file: http://bugs.python.org/file30947/18226IDLEUnitTestFormatParagraph3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18226>
_______________________________________


More information about the Python-bugs-list mailing list