Issue #22629: Revise idle_test.htest, mostly docstring. Start revision of

htests to add # htest # marker for coveragepy and stop tcl errors.
This commit is contained in:
Terry Jan Reedy 2014-10-17 01:31:35 -04:00
parent 9a6f8e1866
commit cd567365c9
8 changed files with 110 additions and 80 deletions

View file

@ -2,7 +2,6 @@
import re
import keyword
import builtins
from tkinter import *
from idlelib.Delegator import Delegator
from idlelib.configHandler import idleConf
@ -234,20 +233,23 @@ def removecolors(self):
for tag in self.tagdefs:
self.tag_remove(tag, "1.0", "end")
def _color_delegator(parent):
def _color_delegator(parent): # htest #
from tkinter import Toplevel, Text
from idlelib.Percolator import Percolator
root = Tk()
root.title("Test ColorDelegator")
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
root.geometry("+%d+%d"%(x, y + 150))
source = "if somename: x = 'abc' # comment\nprint"
text = Text(root, background="white")
text.insert("insert", source)
top = Toplevel(parent)
top.title("Test ColorDelegator")
top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200,
parent.winfo_rooty() + 150))
source = "if somename: x = 'abc' # comment\nprint\n"
text = Text(top, background="white")
text.pack(expand=1, fill="both")
text.insert("insert", source)
text.focus_set()
p = Percolator(text)
d = ColorDelegator()
p.insertfilter(d)
root.mainloop()
if __name__ == "__main__":
from idlelib.idle_test.htest import run