]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-66819: More IDLE htest updates(4) (#112686)
authorTerry Jan Reedy <tjreedy@udel.edu>
Mon, 4 Dec 2023 06:36:40 +0000 (01:36 -0500)
committerGitHub <noreply@github.com>
Mon, 4 Dec 2023 06:36:40 +0000 (06:36 +0000)
Mostly double spacing before 'if __name__...'.

25 files changed:
Lib/idlelib/browser.py
Lib/idlelib/calltip_w.py
Lib/idlelib/config.py
Lib/idlelib/debugobj.py
Lib/idlelib/delegator.py
Lib/idlelib/dynoption.py
Lib/idlelib/editor.py
Lib/idlelib/filelist.py
Lib/idlelib/grep.py
Lib/idlelib/help.py
Lib/idlelib/idle_test/htest.py
Lib/idlelib/iomenu.py
Lib/idlelib/multicall.py
Lib/idlelib/outwin.py
Lib/idlelib/percolator.py
Lib/idlelib/pyshell.py
Lib/idlelib/redirector.py
Lib/idlelib/replace.py
Lib/idlelib/scrolledlist.py
Lib/idlelib/search.py
Lib/idlelib/sidebar.py
Lib/idlelib/statusbar.py
Lib/idlelib/tree.py
Lib/idlelib/undo.py
Lib/idlelib/util.py

index 672e229ffbca94a6a7d9ce34d10dbd7b264c3a75..8b9060e57072ea041f1f3b31ccd5ba1e3ab377de 100644 (file)
@@ -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
index 278546064adde299fa0a9d6416cb668b4051020f..9386376058c79164f221ce6d1532a156ad021245 100644 (file)
@@ -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)
index 898efeb4dd15508ac82cb076ebc17705bd32eed5..92992fd9cce9cd64ec4ad8ad8efb94a3a5e4b015 100644 (file)
@@ -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)
index 0bf2cb1d5bbfe266ab85794641bf74210929ea47..156377f8ed26ac2ec2669860e89dd5c26ba61853 100644 (file)
@@ -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)
index 55c95da8532f47244d57a77e20fc7376502cb388..93ae8bbd43ff44069a23693e1c2847876ee8ff93 100644 (file)
@@ -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)
index d5dfc3eda13f60a959a15480a8e2e9499a7ddc6a..b8937f7106ca75b63944be314ef76681b896d8e4 100644 (file)
@@ -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
index 69b27d0683a1045b7082cf6790a5559229327377..6ad383f460c7ee23352925717699b3cff9dfb44a 100644 (file)
@@ -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)
index f87781d2570fe06b72715864bb7f61a18782209a..e27e5d32a0ff633e3c0973d3758135f80ee7972b 100644 (file)
@@ -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)
index 12513594b76f8fd71ba14e11d9ce8b825244ccd4..ef14349960bfa2c2bb5911c86cc17aee212a49fe 100644 (file)
@@ -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)
index 580a327f620a79283712ae3d9b164c22d3c718c1..3cc7e36e35555b0cf7b6f53040c462b4afe68214 100644 (file)
@@ -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)
index 4042106bf44a9f798eba8d64ff5be3e4e7f5914c..997f85ff5a78b211a5f81bfb0d5cee0a12e67ba8 100644 (file)
@@ -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()
index 7629101635b8bbeb7b89324c5babc42d79a61094..667623ec71ac982b00ca94035fbd1e44deba075a 100644 (file)
@@ -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)
index 2aa4a54125156f7650afc8d9f3322b2bb4c95db2..41f81813113062167b813f1400aff15ad140afc3 100644 (file)
@@ -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)
index 610031e26f1dffed90945f0c755ef50b54c1b872..5ed3f35a7af65584870b6fd616a8efa7e0500453 100644 (file)
@@ -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)
index 91ad7272f4ae560d853e4ead49e71c4d4d9f179d..aa73427c4915c8c0e561d484f40f2af6a1f70f07 100644 (file)
@@ -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)
index 00b3732a7bc4eb4f72acbdd12f471afbe1c86f47..1524fccd5d20f8e960af75d06b21fa74a1e7f976 100755 (executable)
@@ -1694,6 +1694,7 @@ def main():
     root.destroy()
     capture_warnings(False)
 
+
 if __name__ == "__main__":
     main()
 
index 4928340e98df686adc66e2639f495b5881ee63db..08728956abd9008ab7a465a2fc06aa1dd85af65e 100644 (file)
@@ -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)
index ca83173877ad1d9afe0bbd435c9955d71035f918..a29ca59142749157f447a82c88172f393af7f004 100644 (file)
@@ -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)
index 4f1241a576fca1c69d65f6aa5b443f788c7753eb..4fb418db326255665edd408f27fe2c55dbca6f98 100644 (file)
@@ -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)
index b35f3b59c3d2e8f26ed5c2172e7290f84601371a..935a4832257fa4a66b5a83776060ee8f1f9e86a6 100644 (file)
@@ -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)
index 8e7eae5037c90c73a7a901f37802fafa94d8f976..ff77b568a786e0faf0663745c3f3e49de35a04a2 100644 (file)
@@ -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)
index 7048bd64b98753f8a5b3479300dbc9902dbe6f38..8445d4cc8dfdb9ec2e5352cc315dcddbc3ea8989 100644 (file)
@@ -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)
index 5f30f0f6092bfa5a3e11c2607ca16386b96423d8..9c2eb47b24aec94a4761316b45a491d04dd3b28b 100644 (file)
@@ -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)
index f1d03f4c9ed5ef9af2c10bf03edfc5905b56fcc1..f52446d5fcdcf84ee6aeb660feb5dfe42e640cbe 100644 (file)
@@ -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)
index ede670a4db5536028b6e263eafab40e56537cacf..5ac69a7b94cb56d33dce45f013d8765c073e7d33 100644 (file)
@@ -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)