Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 838e968

Browse files
[3.12] gh-66819: More IDLE htest updates(4) (GH-112686) (#112688)
Mostly double spacing before 'if __name__...'. (cherry picked from commit e5b0db0) Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 55a4bb9 commit 838e968

25 files changed

+62
-34
lines changed

Lib/idlelib/browser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def closure():
250250
class Nested_in_closure: pass
251251
ModuleBrowser(parent, file, _htest=True)
252252

253+
253254
if __name__ == "__main__":
254255
if len(sys.argv) == 1: # If pass file on command line, unittest fails.
255256
from unittest import main

Lib/idlelib/calltip_w.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ def calltip_hide(event):
193193

194194
text.focus_set()
195195

196+
196197
if __name__ == '__main__':
197198
from unittest import main
198199
main('idlelib.idle_test.test_calltip_w', verbosity=2, exit=False)

Lib/idlelib/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ def dumpCfg(cfg):
906906
dumpCfg(idleConf.userCfg)
907907
print('\nlines = ', line, ', crc = ', crc, sep='')
908908

909+
909910
if __name__ == '__main__':
910911
from unittest import main
911912
main('idlelib.idle_test.test_config', verbosity=2, exit=False)

Lib/idlelib/debugobj.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def _debug_object_browser(parent): # htest #
135135
node = TreeNode(sc.canvas, None, item)
136136
node.update()
137137

138+
138139
if __name__ == '__main__':
139140
from unittest import main
140141
main('idlelib.idle_test.test_debugobj', verbosity=2, exit=False)

Lib/idlelib/delegator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def setdelegate(self, delegate):
2828
self.resetcache()
2929
self.delegate = delegate
3030

31+
3132
if __name__ == '__main__':
3233
from unittest import main
3334
main('idlelib.idle_test.test_delegator', verbosity=2)

Lib/idlelib/dynoption.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def SetMenu(self,valueList,value=None):
2929
if value:
3030
self.variable.set(value)
3131

32+
3233
def _dyn_option_menu(parent): # htest #
3334
from tkinter import Toplevel # + StringVar, Button
3435

@@ -49,6 +50,7 @@ def update():
4950
button = Button(top, text="Change option set", command=update)
5051
button.pack()
5152

53+
5254
if __name__ == '__main__':
5355
# Only module without unittests because of intention to replace.
5456
from idlelib.idle_test.htest import run

Lib/idlelib/editor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,7 @@ def _editor_window(parent): # htest #
17481748
# Does not stop error, neither does following
17491749
# edit.text.bind("<<close-window>>", edit.close_event)
17501750

1751+
17511752
if __name__ == '__main__':
17521753
from unittest import main
17531754
main('idlelib.idle_test.test_editor', verbosity=2, exit=False)

Lib/idlelib/filelist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def _test(): # TODO check and convert to htest
124124
if flist.inversedict:
125125
root.mainloop()
126126

127+
127128
if __name__ == '__main__':
128129
from unittest import main
129130
main('idlelib.idle_test.test_filelist', verbosity=2)

Lib/idlelib/grep.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,17 @@ def _grep_dialog(parent): # htest #
204204
frame.pack()
205205
text = Text(frame, height=5)
206206
text.pack()
207+
text.insert('1.0', 'import grep')
207208

208209
def show_grep_dialog():
209-
text.tag_add(SEL, "1.0", END)
210+
text.tag_add(SEL, "1.0", '1.end')
210211
grep(text, flist=flist)
211-
text.tag_remove(SEL, "1.0", END)
212+
text.tag_remove(SEL, "1.0", '1.end')
212213

213214
button = Button(frame, text="Show GrepDialog", command=show_grep_dialog)
214215
button.pack()
215216

217+
216218
if __name__ == "__main__":
217219
from unittest import main
218220
main('idlelib.idle_test.test_grep', verbosity=2, exit=False)

Lib/idlelib/help.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def copy_strip():
278278
out.write(line.rstrip() + b'\n')
279279
print(f'{src} copied to {dst}')
280280

281+
281282
def _helpwindow(parent):
282283
"Create HelpWindow; called from Idle Help event handler."
283284
filename = join(abspath(dirname(__file__)), 'help.html')
@@ -286,6 +287,7 @@ def _helpwindow(parent):
286287
return
287288
HelpWindow(parent, filename, 'IDLE Help (%s)' % python_version())
288289

290+
289291
if __name__ == '__main__':
290292
from unittest import main
291293
main('idlelib.idle_test.test_help', verbosity=2, exit=False)

Lib/idlelib/idle_test/htest.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@
170170
'msg': "Click the 'Show GrepDialog' button.\n"
171171
"Test the various 'Find-in-files' functions.\n"
172172
"The results should be displayed in a new '*Output*' window.\n"
173-
"'Right-click'->'Go to file/line' anywhere in the search results "
174-
"should open that file \nin a new EditorWindow."
173+
"'Right-click'->'Go to file/line' in the search results\n "
174+
"should open that file in a new EditorWindow."
175175
}
176176

177177
HelpSource_spec = {
@@ -210,26 +210,6 @@
210210
"Check that changes were saved by opening the file elsewhere."
211211
}
212212

213-
_linenumbers_drag_scrolling_spec = {
214-
'file': 'sidebar',
215-
'kwds': {},
216-
'msg': textwrap.dedent("""\
217-
1. Click on the line numbers and drag down below the edge of the
218-
window, moving the mouse a bit and then leaving it there for a
219-
while. The text and line numbers should gradually scroll down,
220-
with the selection updated continuously.
221-
222-
2. With the lines still selected, click on a line number above
223-
or below the selected lines. Only the line whose number was
224-
clicked should be selected.
225-
226-
3. Repeat step #1, dragging to above the window. The text and
227-
line numbers should gradually scroll up, with the selection
228-
updated continuously.
229-
230-
4. Repeat step #2, clicking a line number below the selection."""),
231-
}
232-
233213
_multi_call_spec = {
234214
'file': 'multicall',
235215
'kwds': {},
@@ -295,6 +275,15 @@
295275
"Click [Close] or [X] to close the 'Replace Dialog'."
296276
}
297277

278+
_scrolled_list_spec = {
279+
'file': 'scrolledlist',
280+
'kwds': {},
281+
'msg': "You should see a scrollable list of items\n"
282+
"Selecting (clicking) or double clicking an item "
283+
"prints the name to the console or Idle shell.\n"
284+
"Right clicking an item will display a popup."
285+
}
286+
298287
_search_dialog_spec = {
299288
'file': 'search',
300289
'kwds': {},
@@ -310,21 +299,31 @@
310299
"Its only action is to close."
311300
}
312301

313-
_scrolled_list_spec = {
314-
'file': 'scrolledlist',
302+
_sidebar_number_scrolling_spec = {
303+
'file': 'sidebar',
315304
'kwds': {},
316-
'msg': "You should see a scrollable list of items\n"
317-
"Selecting (clicking) or double clicking an item "
318-
"prints the name to the console or Idle shell.\n"
319-
"Right clicking an item will display a popup."
305+
'msg': textwrap.dedent("""\
306+
1. Click on the line numbers and drag down below the edge of the
307+
window, moving the mouse a bit and then leaving it there for a
308+
while. The text and line numbers should gradually scroll down,
309+
with the selection updated continuously.
310+
311+
2. With the lines still selected, click on a line number above
312+
or below the selected lines. Only the line whose number was
313+
clicked should be selected.
314+
315+
3. Repeat step #1, dragging to above the window. The text and
316+
line numbers should gradually scroll up, with the selection
317+
updated continuously.
318+
319+
4. Repeat step #2, clicking a line number below the selection."""),
320320
}
321321

322322
_stackbrowser_spec = {
323323
'file': 'stackviewer',
324324
'kwds': {},
325325
'msg': "A stacktrace for a NameError exception.\n"
326-
"Expand 'idlelib ...' and '<locals>'.\n"
327-
"Check that exc_value, exc_tb, and exc_type are correct.\n"
326+
"Should have NameError and 1 traceback line."
328327
}
329328

330329
_tooltip_spec = {
@@ -438,5 +437,6 @@ def close(_=None):
438437
next_test()
439438
root.mainloop()
440439

440+
441441
if __name__ == '__main__':
442442
run()

Lib/idlelib/iomenu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ def updaterecentfileslist(self,filename):
393393
if self.editwin.flist:
394394
self.editwin.update_recent_files_list(filename)
395395

396+
396397
def _io_binding(parent): # htest #
397398
from tkinter import Toplevel, Text
398399

@@ -430,6 +431,7 @@ def savecopy(self, event):
430431
editwin = MyEditWin(text)
431432
IOBinding(editwin)
432433

434+
433435
if __name__ == "__main__":
434436
from unittest import main
435437
main('idlelib.idle_test.test_iomenu', verbosity=2, exit=False)

Lib/idlelib/multicall.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ def handler(event):
442442
bindseq("<Enter>")
443443
bindseq("<Leave>")
444444

445+
445446
if __name__ == "__main__":
446447
from unittest import main
447448
main('idlelib.idle_test.test_mainmenu', verbosity=2, exit=False)

Lib/idlelib/outwin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def setup(self):
182182
text.tag_raise('sel')
183183
self.write = self.owin.write
184184

185+
185186
if __name__ == '__main__':
186187
from unittest import main
187188
main('idlelib.idle_test.test_outwin', verbosity=2, exit=False)

Lib/idlelib/percolator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ def toggle2():
103103
(pin if var2.get() else pout)(t2)
104104

105105
text.pack()
106+
text.focus_set()
106107
var1 = tk.IntVar(parent)
107108
cb1 = tk.Checkbutton(top, text="Tracer1", command=toggle1, variable=var1)
108109
cb1.pack()
109110
var2 = tk.IntVar(parent)
110111
cb2 = tk.Checkbutton(top, text="Tracer2", command=toggle2, variable=var2)
111112
cb2.pack()
112113

114+
113115
if __name__ == "__main__":
114116
from unittest import main
115117
main('idlelib.idle_test.test_percolator', verbosity=2, exit=False)

Lib/idlelib/pyshell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,7 @@ def main():
16941694
root.destroy()
16951695
capture_warnings(False)
16961696

1697+
16971698
if __name__ == "__main__":
16981699
main()
16991700

Lib/idlelib/redirector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def my_insert(*args):
164164
original_insert(*args)
165165
original_insert = redir.register("insert", my_insert)
166166

167+
167168
if __name__ == "__main__":
168169
from unittest import main
169170
main('idlelib.idle_test.test_redirector', verbosity=2, exit=False)

Lib/idlelib/replace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def show_replace():
299299
button = Button(frame, text="Replace", command=show_replace)
300300
button.pack()
301301

302+
302303
if __name__ == '__main__':
303304
from unittest import main
304305
main('idlelib.idle_test.test_replace', verbosity=2, exit=False)

Lib/idlelib/scrolledlist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def on_double(self, index): print("double", self.get(index))
142142
for i in range(30):
143143
scrolled_list.append("Item %02d" % i)
144144

145+
145146
if __name__ == '__main__':
146147
from unittest import main
147148
main('idlelib.idle_test.test_scrolledlist', verbosity=2, exit=False)

Lib/idlelib/search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def show_find():
156156
button = Button(frame, text="Search (selection ignored)", command=show_find)
157157
button.pack()
158158

159+
159160
if __name__ == '__main__':
160161
from unittest import main
161162
main('idlelib.idle_test.test_search', verbosity=2, exit=False)

Lib/idlelib/sidebar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def update_colors(self):
514514
self.change_callback()
515515

516516

517-
def _linenumbers_drag_scrolling(parent): # htest #
517+
def _sidebar_number_scrolling(parent): # htest #
518518
from idlelib.idle_test.test_sidebar import Dummy_editwin
519519

520520
top = tk.Toplevel(parent)
@@ -541,4 +541,4 @@ def _linenumbers_drag_scrolling(parent): # htest #
541541
main('idlelib.idle_test.test_sidebar', verbosity=2, exit=False)
542542

543543
from idlelib.idle_test.htest import run
544-
run(_linenumbers_drag_scrolling)
544+
run(_sidebar_number_scrolling)

Lib/idlelib/statusbar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def change():
4343
button.pack(side='bottom')
4444
frame.pack()
4545

46+
4647
if __name__ == '__main__':
4748
from unittest import main
4849
main('idlelib.idle_test.test_statusbar', verbosity=2, exit=False)

Lib/idlelib/tree.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ def _tree_widget(parent): # htest #
492492
node = TreeNode(sc.canvas, None, item)
493493
node.expand()
494494

495+
495496
if __name__ == '__main__':
496497
from unittest import main
497498
main('idlelib.idle_test.test_tree', verbosity=2, exit=False)

Lib/idlelib/undo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ def _undo_delegator(parent): # htest #
358358
dump = Button(top, text="Dump", command=lambda:d.dump_event(None))
359359
dump.pack(side='left')
360360

361+
361362
if __name__ == "__main__":
362363
from unittest import main
363364
main('idlelib.idle_test.test_undo', verbosity=2, exit=False)

Lib/idlelib/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# .pyw is for Windows; .pyi is for stub files.
1717
py_extensions = ('.py', '.pyw', '.pyi') # Order needed for open/save dialogs.
1818

19+
1920
if __name__ == '__main__':
2021
from unittest import main
2122
main('idlelib.idle_test.test_util', verbosity=2)

0 commit comments

Comments
 (0)