cpython: 22ce68d98345 (original) (raw)

Mercurial > cpython

changeset 84613:22ce68d98345 3.3

Issue #18279: Add tests for idlelib/RstripExtension.py. Original patch by Phil Webster. With that available, modify RstripExtension.py to stop deleting null slices, which caused a file to be marked as changed when it was not. [#18279]

Terry Jan Reedy tjreedy@udel.edu
date Sat, 13 Jul 2013 02:34:43 -0400
parents f91e6d0eb0f7
children ffd923b388d8 bc3a34e47923
files Lib/idlelib/RstripExtension.py Lib/idlelib/idle_test/mock_idle.py Lib/idlelib/idle_test/test_rstrip.py Misc/ACKS Misc/NEWS
diffstat 5 files changed, 94 insertions(+), 8 deletions(-)[+] [-] Lib/idlelib/RstripExtension.py 20 Lib/idlelib/idle_test/mock_idle.py 27 Lib/idlelib/idle_test/test_rstrip.py 49 Misc/ACKS 1 Misc/NEWS 5

line wrap: on

line diff

--- a/Lib/idlelib/RstripExtension.py +++ b/Lib/idlelib/RstripExtension.py @@ -1,13 +1,9 @@ 'Provides "Strip trailing whitespace" under the "Format" menu.' -author = "Roger D. Serwy <roger.serwy at gmail.com>" - class RstripExtension: menudefs = [

def init(self, editwin): self.editwin = editwin @@ -20,10 +16,18 @@ class RstripExtension: undo.undo_block_start()

undo.undo_block_stop() + +if name == "main":

new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/mock_idle.py @@ -0,0 +1,27 @@ +'''Mock classes that imitate idlelib modules or classes. + +Attributes and methods will be added as needed for tests. +''' + +from idlelib.idle_test.mock_tk import Text + +class Editor:

+

+ +class UndoDelegator:

new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_rstrip.py @@ -0,0 +1,49 @@ +import unittest +import idlelib.RstripExtension as rs +from idlelib.idle_test.mock_idle import Editor + +class rstripTest(unittest.TestCase): +

+

+

+## from idlelib.EditorWindow import EditorWindow as Editor +## from tkinter import Tk +## editor = Editor(root=Tk())

+

+

+ +if name == 'main':

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -1303,6 +1303,7 @@ Aaron Watters Henrik Weber Corran Webster Glyn Webster +Phil Webster Stefan Wehr Zack Weinberg Bob Weiner

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -160,6 +160,10 @@ C API IDLE ---- +- Issue #18279: Format - Strip trailing whitespace no longer marks a file as