cpython: 038cbbef4539 (original) (raw)

Mercurial > cpython

changeset 90818:038cbbef4539 3.4

Issue #21477: Idle htest: merge and modify run and runall; add many tests. Patch by Saimadhav Heblikar [#21477]

Terry Jan Reedy tjreedy@udel.edu
date Sat, 24 May 2014 18:48:18 -0400
parents 854404294f34
children eb86a3c81dbb 3fa76139c908
files Lib/idlelib/CallTipWindow.py Lib/idlelib/ClassBrowser.py Lib/idlelib/ColorDelegator.py Lib/idlelib/IOBinding.py Lib/idlelib/MultiCall.py Lib/idlelib/MultiStatusBar.py Lib/idlelib/ObjectBrowser.py Lib/idlelib/PathBrowser.py Lib/idlelib/ScrolledList.py Lib/idlelib/ToolTip.py Lib/idlelib/TreeWidget.py Lib/idlelib/WidgetRedirector.py Lib/idlelib/aboutDialog.py Lib/idlelib/configHelpSourceEdit.py Lib/idlelib/dynOptionMenuWidget.py Lib/idlelib/idle_test/htest.py Lib/idlelib/tabbedpages.py Lib/idlelib/textView.py
diffstat 18 files changed, 409 insertions(+), 176 deletions(-)[+] [-] Lib/idlelib/CallTipWindow.py 51 Lib/idlelib/ClassBrowser.py 20 Lib/idlelib/ColorDelegator.py 16 Lib/idlelib/IOBinding.py 16 Lib/idlelib/MultiCall.py 12 Lib/idlelib/MultiStatusBar.py 35 Lib/idlelib/ObjectBrowser.py 10 Lib/idlelib/PathBrowser.py 20 Lib/idlelib/ScrolledList.py 19 Lib/idlelib/ToolTip.py 21 Lib/idlelib/TreeWidget.py 32 Lib/idlelib/WidgetRedirector.py 15 Lib/idlelib/aboutDialog.py 11 Lib/idlelib/configHelpSourceEdit.py 27 Lib/idlelib/dynOptionMenuWidget.py 26 Lib/idlelib/idle_test/htest.py 214 Lib/idlelib/tabbedpages.py 10 Lib/idlelib/textView.py 30

line wrap: on

line diff

--- a/Lib/idlelib/CallTipWindow.py +++ b/Lib/idlelib/CallTipWindow.py @@ -133,37 +133,36 @@ class CallTip: return bool(self.tipwindow) +def _calltip_window(parent):

-############################### -# -# Test Code -# -class container: # Conceptually an editor_window

-def main():

if name=='main':

--- a/Lib/idlelib/ClassBrowser.py +++ b/Lib/idlelib/ClassBrowser.py @@ -13,6 +13,7 @@ XXX TO DO: import os import sys import pyclbr +import re from idlelib import PyShell from idlelib.WindowList import ListedToplevel @@ -21,11 +22,15 @@ from idlelib.configHandler import idleCo class ClassBrowser:

def close(self, event=None): @@ -40,6 +45,9 @@ class ClassBrowser: self.top = top = ListedToplevel(flist.root) top.protocol("WM_DELETE_WINDOW", self.close) top.bind("", self.close)

@@ -202,7 +210,7 @@ class MethodBrowserTreeItem(TreeItem): edit = PyShell.flist.open(self.file) edit.gotoline(self.cl.methods[self.name]) -def main(): +def _class_browser(parent): #Wrapper for htest try: file = file except NameError: @@ -213,9 +221,9 @@ def main(): file = sys.argv[0] dir, file = os.path.split(file) name = os.path.splitext(file)[0]

if name == "main":

--- a/Lib/idlelib/ColorDelegator.py +++ b/Lib/idlelib/ColorDelegator.py @@ -253,17 +253,23 @@ class ColorDelegator(Delegator): for tag in self.tagdefs: self.tag_remove(tag, "1.0", "end") -def main(): +def _color_delegator(parent): from idlelib.Percolator import Percolator root = Tk()

--- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -525,16 +525,17 @@ class IOBinding: if self.editwin.flist: self.editwin.update_recent_files_list(filename) -def test(): +def _io_binding(parent): root = Tk()

@@ -542,16 +543,13 @@ def test(): self.text.event_generate("<>") def save(self, event): self.text.event_generate("<>")

+ text = Text(root) text.pack() text.focus_set() editwin = MyEditWin(text) io = IOBinding(editwin)

if name == "main":

--- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -420,9 +420,12 @@ def MultiCallCreator(widget): _multicall_dict[widget] = MultiCall return MultiCall -if name == "main":

+ +def _multi_call(parent): root = tkinter.Tk()

--- a/Lib/idlelib/MultiStatusBar.py +++ b/Lib/idlelib/MultiStatusBar.py @@ -17,16 +17,29 @@ class MultiStatusBar(Frame): label = self.labels[name] label.config(text=text) -def _test():

+def _multistatus_bar(parent):

+

+

if name == 'main':

--- a/Lib/idlelib/ObjectBrowser.py +++ b/Lib/idlelib/ObjectBrowser.py @@ -9,6 +9,8 @@

XXX TO DO:

- for classes/modules, add "open source" to object browser

+import re + from idlelib.TreeWidget import TreeItem, TreeNode, ScrolledCanvas from reprlib import Repr @@ -119,12 +121,13 @@ def make_objecttreeitem(labeltext, objec c = ObjectTreeItem return c(labeltext, object, setfunction) -# Test script -def _test(): +def _object_browser(parent): import sys from tkinter import Tk root = Tk()

--- a/Lib/idlelib/PathBrowser.py +++ b/Lib/idlelib/PathBrowser.py @@ -1,13 +1,20 @@ import os import sys +import re import importlib.machinery from idlelib.TreeWidget import TreeItem from idlelib.ClassBrowser import ClassBrowser, ModuleBrowserTreeItem +from idlelib.PyShell import PyShellFileList + class PathBrowser(ClassBrowser):

def settitle(self): @@ -87,12 +94,13 @@ class DirBrowserTreeItem(TreeItem): sorted.sort() return sorted -def main():

+def _path_browser(parent):

if name == "main": from unittest import main main('idlelib.idle_test.test_pathbrowser', verbosity=2, exit=False) +

--- a/Lib/idlelib/ScrolledList.py +++ b/Lib/idlelib/ScrolledList.py @@ -119,21 +119,22 @@ class ScrolledList: pass -def test(): +def _scrolled_list(parent): root = Tk()

+

-def main():

--- a/Lib/idlelib/ToolTip.py +++ b/Lib/idlelib/ToolTip.py @@ -76,14 +76,21 @@ class ListboxToolTip(ToolTipBase): for item in self.items: listbox.insert(END, item) -def main():

+def _tooltip(parent): root = Tk()

--- a/Lib/idlelib/TreeWidget.py +++ b/Lib/idlelib/TreeWidget.py @@ -448,29 +448,27 @@ class ScrolledCanvas: return "break" -# Testing functions - -def test():

+def _tree_widget(parent):

+

if name == 'main':

--- a/Lib/idlelib/WidgetRedirector.py +++ b/Lib/idlelib/WidgetRedirector.py @@ -104,10 +104,12 @@ class OriginalCommand: return self.tk_call(self.orig_and_operation + args) -def main(): +def _widget_redirector(parent): root = Tk()

if name == "main":

--- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -12,11 +12,16 @@ class AboutDialog(Toplevel): """Modal about dialog for idle """

--- a/Lib/idlelib/configHelpSourceEdit.py +++ b/Lib/idlelib/configHelpSourceEdit.py @@ -8,13 +8,14 @@ import tkinter.messagebox as tkMessageBo import tkinter.filedialog as tkFileDialog class GetHelpSourceDialog(Toplevel):

User selects a name for the Help resource and provides a web url or a local file as its source. The user can enter a url or browse for the file.

@@ -31,12 +32,14 @@ class GetHelpSourceDialog(Toplevel): self.withdraw() #hide while setting geometry #needs to be done here so that the winfo_reqwidth is valid self.update_idletasks()

@@ -159,11 +162,5 @@ class GetHelpSourceDialog(Toplevel): self.destroy() if name == 'main':

--- a/Lib/idlelib/dynOptionMenuWidget.py +++ b/Lib/idlelib/dynOptionMenuWidget.py @@ -2,9 +2,10 @@ OptionMenu widget modified to allow dynamic menu reconfiguration and setting of highlightthickness """ -from tkinter import OptionMenu -from tkinter import _setit +from tkinter import OptionMenu, _setit, Tk, StringVar, Button + import copy +import re class DynOptionMenu(OptionMenu): """ @@ -33,3 +34,24 @@ class DynOptionMenu(OptionMenu): command=_setit(self.variable,item,self.command)) if value: self.variable.set(value) + +def _dyn_option_menu(parent):

+

+

+ +if name == 'main':

--- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -35,17 +35,51 @@ import tkinter as tk AboutDialog_spec = { 'file': 'aboutDialog',

+ +_calltip_window_spec = {

-_editor_window_spec = {

+_color_delegator_spec = {

+ +#_editor_window_spec = { +# 'file': 'EditorWindow', +# 'kwds': {}, +# 'msg': "Test editor functions of interest" +# } + GetCfgSectionNameDialog_spec = { 'file': 'configSectionNameDialog', 'kwds': {'title':'Get Name', @@ -54,7 +88,19 @@ GetCfgSectionNameDialog_spec = { '_htest': True}, 'msg': "After the text entered with [Ok] is stripped, , " "'abc', or more that 30 chars are errors.\n"

+GetHelpSourceDialog_spec = {

+_io_binding_spec = {

+

+ +_multi_call_spec = {

+ +_multistatus_bar_spec = {

+ +_object_browser_spec = {

+ +_path_browser_spec = {

+ +_scrolled_list_spec = {

+ +_tabbed_pages_spec = {

+ +TextViewer_spec = {

+ +_tooltip_spec = {

+ +_tree_widget_spec = {

+ +_widget_redirector_spec = {

+ +def run(test=None): root = tk.Tk()

+

+ +

+ def run_test():

+

+

+ root.mainloop() -def runall():

- if name == 'main':

--- a/Lib/idlelib/tabbedpages.py +++ b/Lib/idlelib/tabbedpages.py @@ -467,9 +467,12 @@ class TabbedPageSet(Frame): self._tab_set.set_selected_tab(page_name) -if name == 'main': +def _tabbed_pages(parent): # test dialog root=Tk()

@@ -488,3 +491,8 @@ if name == 'main': labelPgName.pack(padx=5) entryPgName.pack(padx=5) root.mainloop() + + +if name == 'main':

--- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -9,15 +9,17 @@ class TextViewer(Toplevel): """A simple text viewer dialog for IDLE """

@@ -74,24 +76,6 @@ def view_file(parent, title, filename, e else: return view_text(parent, title, contents, modal) - if name == 'main':