aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--Lib/idlelib/browser.py1
-rw-r--r--Lib/idlelib/calltip_w.py1
-rw-r--r--Lib/idlelib/config.py1
-rw-r--r--Lib/idlelib/debugobj.py1
-rw-r--r--Lib/idlelib/delegator.py1
-rw-r--r--Lib/idlelib/dynoption.py2
-rw-r--r--Lib/idlelib/editor.py1
-rw-r--r--Lib/idlelib/filelist.py1
-rw-r--r--Lib/idlelib/grep.py6
-rw-r--r--Lib/idlelib/help.py2
-rw-r--r--Lib/idlelib/idle_test/htest.py60
-rw-r--r--Lib/idlelib/iomenu.py2
-rw-r--r--Lib/idlelib/multicall.py1
-rw-r--r--Lib/idlelib/outwin.py1
-rw-r--r--Lib/idlelib/percolator.py2
-rwxr-xr-xLib/idlelib/pyshell.py1
-rw-r--r--Lib/idlelib/redirector.py1
-rw-r--r--Lib/idlelib/replace.py1
-rw-r--r--Lib/idlelib/scrolledlist.py1
-rw-r--r--Lib/idlelib/search.py1
-rw-r--r--Lib/idlelib/sidebar.py4
-rw-r--r--Lib/idlelib/statusbar.py1
-rw-r--r--Lib/idlelib/tree.py1
-rw-r--r--Lib/idlelib/undo.py1
-rw-r--r--Lib/idlelib/util.py1
25 files changed, 62 insertions, 34 deletions
diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py
index 672e229ffbc..8b9060e5707 100644
--- a/Lib/idlelib/browser.py
+++ b/Lib/idlelib/browser.py
@@ -250,6 +250,7 @@ def _module_browser(parent): # htest #
class Nested_in_closure: pass
ModuleBrowser(parent, file, _htest=True)
+
if __name__ == "__main__":
if len(sys.argv) == 1: # If pass file on command line, unittest fails.
from unittest import main
diff --git a/Lib/idlelib/calltip_w.py b/Lib/idlelib/calltip_w.py
index 278546064ad..9386376058c 100644
--- a/Lib/idlelib/calltip_w.py
+++ b/Lib/idlelib/calltip_w.py
@@ -193,6 +193,7 @@ def _calltip_window(parent): # htest #
text.focus_set()
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_calltip_w', verbosity=2, exit=False)
diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py
index 898efeb4dd1..92992fd9cce 100644
--- a/Lib/idlelib/config.py
+++ b/Lib/idlelib/config.py
@@ -906,6 +906,7 @@ def _dump(): # htest # (not really, but ignore in coverage)
dumpCfg(idleConf.userCfg)
print('\nlines = ', line, ', crc = ', crc, sep='')
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_config', verbosity=2, exit=False)
diff --git a/Lib/idlelib/debugobj.py b/Lib/idlelib/debugobj.py
index 0bf2cb1d5bb..156377f8ed2 100644
--- a/Lib/idlelib/debugobj.py
+++ b/Lib/idlelib/debugobj.py
@@ -135,6 +135,7 @@ def _debug_object_browser(parent): # htest #
node = TreeNode(sc.canvas, None, item)
node.update()
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_debugobj', verbosity=2, exit=False)
diff --git a/Lib/idlelib/delegator.py b/Lib/idlelib/delegator.py
index 55c95da8532..93ae8bbd43f 100644
--- a/Lib/idlelib/delegator.py
+++ b/Lib/idlelib/delegator.py
@@ -28,6 +28,7 @@ class Delegator:
self.resetcache()
self.delegate = delegate
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_delegator', verbosity=2)
diff --git a/Lib/idlelib/dynoption.py b/Lib/idlelib/dynoption.py
index d5dfc3eda13..b8937f7106c 100644
--- a/Lib/idlelib/dynoption.py
+++ b/Lib/idlelib/dynoption.py
@@ -29,6 +29,7 @@ class DynOptionMenu(OptionMenu):
if value:
self.variable.set(value)
+
def _dyn_option_menu(parent): # htest #
from tkinter import Toplevel # + StringVar, Button
@@ -49,6 +50,7 @@ def _dyn_option_menu(parent): # htest #
button = Button(top, text="Change option set", command=update)
button.pack()
+
if __name__ == '__main__':
# Only module without unittests because of intention to replace.
from idlelib.idle_test.htest import run
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index 69b27d0683a..6ad383f460c 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -1748,6 +1748,7 @@ def _editor_window(parent): # htest #
# Does not stop error, neither does following
# edit.text.bind("<<close-window>>", edit.close_event)
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_editor', verbosity=2, exit=False)
diff --git a/Lib/idlelib/filelist.py b/Lib/idlelib/filelist.py
index f87781d2570..e27e5d32a0f 100644
--- a/Lib/idlelib/filelist.py
+++ b/Lib/idlelib/filelist.py
@@ -124,6 +124,7 @@ def _test(): # TODO check and convert to htest
if flist.inversedict:
root.mainloop()
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_filelist', verbosity=2)
diff --git a/Lib/idlelib/grep.py b/Lib/idlelib/grep.py
index 12513594b76..ef14349960b 100644
--- a/Lib/idlelib/grep.py
+++ b/Lib/idlelib/grep.py
@@ -204,15 +204,17 @@ def _grep_dialog(parent): # htest #
frame.pack()
text = Text(frame, height=5)
text.pack()
+ text.insert('1.0', 'import grep')
def show_grep_dialog():
- text.tag_add(SEL, "1.0", END)
+ text.tag_add(SEL, "1.0", '1.end')
grep(text, flist=flist)
- text.tag_remove(SEL, "1.0", END)
+ text.tag_remove(SEL, "1.0", '1.end')
button = Button(frame, text="Show GrepDialog", command=show_grep_dialog)
button.pack()
+
if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_grep', verbosity=2, exit=False)
diff --git a/Lib/idlelib/help.py b/Lib/idlelib/help.py
index 580a327f620..3cc7e36e355 100644
--- a/Lib/idlelib/help.py
+++ b/Lib/idlelib/help.py
@@ -278,6 +278,7 @@ def copy_strip():
out.write(line.rstrip() + b'\n')
print(f'{src} copied to {dst}')
+
def _helpwindow(parent):
"Create HelpWindow; called from Idle Help event handler."
filename = join(abspath(dirname(__file__)), 'help.html')
@@ -286,6 +287,7 @@ def _helpwindow(parent):
return
HelpWindow(parent, filename, 'IDLE Help (%s)' % python_version())
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_help', verbosity=2, exit=False)
diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py
index 4042106bf44..997f85ff5a7 100644
--- a/Lib/idlelib/idle_test/htest.py
+++ b/Lib/idlelib/idle_test/htest.py
@@ -170,8 +170,8 @@ _grep_dialog_spec = {
'msg': "Click the 'Show GrepDialog' button.\n"
"Test the various 'Find-in-files' functions.\n"
"The results should be displayed in a new '*Output*' window.\n"
- "'Right-click'->'Go to file/line' anywhere in the search results "
- "should open that file \nin a new EditorWindow."
+ "'Right-click'->'Go to file/line' in the search results\n "
+ "should open that file in a new EditorWindow."
}
HelpSource_spec = {
@@ -210,26 +210,6 @@ _io_binding_spec = {
"Check that changes were saved by opening the file elsewhere."
}
-_linenumbers_drag_scrolling_spec = {
- 'file': 'sidebar',
- 'kwds': {},
- 'msg': textwrap.dedent("""\
- 1. Click on the line numbers and drag down below the edge of the
- window, moving the mouse a bit and then leaving it there for a
- while. The text and line numbers should gradually scroll down,
- with the selection updated continuously.
-
- 2. With the lines still selected, click on a line number above
- or below the selected lines. Only the line whose number was
- clicked should be selected.
-
- 3. Repeat step #1, dragging to above the window. The text and
- line numbers should gradually scroll up, with the selection
- updated continuously.
-
- 4. Repeat step #2, clicking a line number below the selection."""),
- }
-
_multi_call_spec = {
'file': 'multicall',
'kwds': {},
@@ -295,6 +275,15 @@ _replace_dialog_spec = {
"Click [Close] or [X] to close the 'Replace Dialog'."
}
+_scrolled_list_spec = {
+ 'file': 'scrolledlist',
+ 'kwds': {},
+ 'msg': "You should see a scrollable list of items\n"
+ "Selecting (clicking) or double clicking an item "
+ "prints the name to the console or Idle shell.\n"
+ "Right clicking an item will display a popup."
+ }
+
_search_dialog_spec = {
'file': 'search',
'kwds': {},
@@ -310,21 +299,31 @@ _searchbase_spec = {
"Its only action is to close."
}
-_scrolled_list_spec = {
- 'file': 'scrolledlist',
+_sidebar_number_scrolling_spec = {
+ 'file': 'sidebar',
'kwds': {},
- 'msg': "You should see a scrollable list of items\n"
- "Selecting (clicking) or double clicking an item "
- "prints the name to the console or Idle shell.\n"
- "Right clicking an item will display a popup."
+ 'msg': textwrap.dedent("""\
+ 1. Click on the line numbers and drag down below the edge of the
+ window, moving the mouse a bit and then leaving it there for a
+ while. The text and line numbers should gradually scroll down,
+ with the selection updated continuously.
+
+ 2. With the lines still selected, click on a line number above
+ or below the selected lines. Only the line whose number was
+ clicked should be selected.
+
+ 3. Repeat step #1, dragging to above the window. The text and
+ line numbers should gradually scroll up, with the selection
+ updated continuously.
+
+ 4. Repeat step #2, clicking a line number below the selection."""),
}
_stackbrowser_spec = {
'file': 'stackviewer',
'kwds': {},
'msg': "A stacktrace for a NameError exception.\n"
- "Expand 'idlelib ...' and '<locals>'.\n"
- "Check that exc_value, exc_tb, and exc_type are correct.\n"
+ "Should have NameError and 1 traceback line."
}
_tooltip_spec = {
@@ -438,5 +437,6 @@ def run(*tests):
next_test()
root.mainloop()
+
if __name__ == '__main__':
run()
diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py
index 7629101635b..667623ec71a 100644
--- a/Lib/idlelib/iomenu.py
+++ b/Lib/idlelib/iomenu.py
@@ -393,6 +393,7 @@ class IOBinding:
if self.editwin.flist:
self.editwin.update_recent_files_list(filename)
+
def _io_binding(parent): # htest #
from tkinter import Toplevel, Text
@@ -430,6 +431,7 @@ def _io_binding(parent): # htest #
editwin = MyEditWin(text)
IOBinding(editwin)
+
if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_iomenu', verbosity=2, exit=False)
diff --git a/Lib/idlelib/multicall.py b/Lib/idlelib/multicall.py
index 2aa4a541251..41f81813113 100644
--- a/Lib/idlelib/multicall.py
+++ b/Lib/idlelib/multicall.py
@@ -442,6 +442,7 @@ def _multi_call(parent): # htest #
bindseq("<Enter>")
bindseq("<Leave>")
+
if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_mainmenu', verbosity=2, exit=False)
diff --git a/Lib/idlelib/outwin.py b/Lib/idlelib/outwin.py
index 610031e26f1..5ed3f35a7af 100644
--- a/Lib/idlelib/outwin.py
+++ b/Lib/idlelib/outwin.py
@@ -182,6 +182,7 @@ class OnDemandOutputWindow:
text.tag_raise('sel')
self.write = self.owin.write
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_outwin', verbosity=2, exit=False)
diff --git a/Lib/idlelib/percolator.py b/Lib/idlelib/percolator.py
index 91ad7272f4a..aa73427c491 100644
--- a/Lib/idlelib/percolator.py
+++ b/Lib/idlelib/percolator.py
@@ -103,6 +103,7 @@ def _percolator(parent): # htest #
(pin if var2.get() else pout)(t2)
text.pack()
+ text.focus_set()
var1 = tk.IntVar(parent)
cb1 = tk.Checkbutton(top, text="Tracer1", command=toggle1, variable=var1)
cb1.pack()
@@ -110,6 +111,7 @@ def _percolator(parent): # htest #
cb2 = tk.Checkbutton(top, text="Tracer2", command=toggle2, variable=var2)
cb2.pack()
+
if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_percolator', verbosity=2, exit=False)
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index 00b3732a7bc..1524fccd5d2 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -1694,6 +1694,7 @@ def main():
root.destroy()
capture_warnings(False)
+
if __name__ == "__main__":
main()
diff --git a/Lib/idlelib/redirector.py b/Lib/idlelib/redirector.py
index 4928340e98d..08728956abd 100644
--- a/Lib/idlelib/redirector.py
+++ b/Lib/idlelib/redirector.py
@@ -164,6 +164,7 @@ def _widget_redirector(parent): # htest #
original_insert(*args)
original_insert = redir.register("insert", my_insert)
+
if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_redirector', verbosity=2, exit=False)
diff --git a/Lib/idlelib/replace.py b/Lib/idlelib/replace.py
index ca83173877a..a29ca591427 100644
--- a/Lib/idlelib/replace.py
+++ b/Lib/idlelib/replace.py
@@ -299,6 +299,7 @@ def _replace_dialog(parent): # htest #
button = Button(frame, text="Replace", command=show_replace)
button.pack()
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_replace', verbosity=2, exit=False)
diff --git a/Lib/idlelib/scrolledlist.py b/Lib/idlelib/scrolledlist.py
index 4f1241a576f..4fb418db326 100644
--- a/Lib/idlelib/scrolledlist.py
+++ b/Lib/idlelib/scrolledlist.py
@@ -142,6 +142,7 @@ def _scrolled_list(parent): # htest #
for i in range(30):
scrolled_list.append("Item %02d" % i)
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_scrolledlist', verbosity=2, exit=False)
diff --git a/Lib/idlelib/search.py b/Lib/idlelib/search.py
index b35f3b59c3d..935a4832257 100644
--- a/Lib/idlelib/search.py
+++ b/Lib/idlelib/search.py
@@ -156,6 +156,7 @@ def _search_dialog(parent): # htest #
button = Button(frame, text="Search (selection ignored)", command=show_find)
button.pack()
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_search', verbosity=2, exit=False)
diff --git a/Lib/idlelib/sidebar.py b/Lib/idlelib/sidebar.py
index 8e7eae5037c..ff77b568a78 100644
--- a/Lib/idlelib/sidebar.py
+++ b/Lib/idlelib/sidebar.py
@@ -513,7 +513,7 @@ class ShellSidebar(BaseSideBar):
self.change_callback()
-def _linenumbers_drag_scrolling(parent): # htest #
+def _sidebar_number_scrolling(parent): # htest #
from idlelib.idle_test.test_sidebar import Dummy_editwin
top = tk.Toplevel(parent)
@@ -540,4 +540,4 @@ if __name__ == '__main__':
main('idlelib.idle_test.test_sidebar', verbosity=2, exit=False)
from idlelib.idle_test.htest import run
- run(_linenumbers_drag_scrolling)
+ run(_sidebar_number_scrolling)
diff --git a/Lib/idlelib/statusbar.py b/Lib/idlelib/statusbar.py
index 7048bd64b98..8445d4cc8df 100644
--- a/Lib/idlelib/statusbar.py
+++ b/Lib/idlelib/statusbar.py
@@ -43,6 +43,7 @@ def _multistatus_bar(parent): # htest #
button.pack(side='bottom')
frame.pack()
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_statusbar', verbosity=2, exit=False)
diff --git a/Lib/idlelib/tree.py b/Lib/idlelib/tree.py
index 5f30f0f6092..9c2eb47b24a 100644
--- a/Lib/idlelib/tree.py
+++ b/Lib/idlelib/tree.py
@@ -492,6 +492,7 @@ def _tree_widget(parent): # htest #
node = TreeNode(sc.canvas, None, item)
node.expand()
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_tree', verbosity=2, exit=False)
diff --git a/Lib/idlelib/undo.py b/Lib/idlelib/undo.py
index f1d03f4c9ed..f52446d5fcd 100644
--- a/Lib/idlelib/undo.py
+++ b/Lib/idlelib/undo.py
@@ -358,6 +358,7 @@ def _undo_delegator(parent): # htest #
dump = Button(top, text="Dump", command=lambda:d.dump_event(None))
dump.pack(side='left')
+
if __name__ == "__main__":
from unittest import main
main('idlelib.idle_test.test_undo', verbosity=2, exit=False)
diff --git a/Lib/idlelib/util.py b/Lib/idlelib/util.py
index ede670a4db5..5ac69a7b94c 100644
--- a/Lib/idlelib/util.py
+++ b/Lib/idlelib/util.py
@@ -16,6 +16,7 @@ TODO:
# .pyw is for Windows; .pyi is for stub files.
py_extensions = ('.py', '.pyw', '.pyi') # Order needed for open/save dialogs.
+
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_util', verbosity=2)