aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/idlelib/idle_test/mock_tk.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2021-01-25 06:33:18 -0500
committerGitHub <noreply@github.com>2021-01-25 06:33:18 -0500
commit879986d8a932c4524cb6ff822afc9537de16e28d (patch)
tree897aea5f98000a01fad09fa83303d3d5086ae61b /Lib/idlelib/idle_test/mock_tk.py
parentcf19cc3b920ca5995e1c202d2c3dd7a59ac8eac8 (diff)
downloadcpython-879986d8a932c4524cb6ff822afc9537de16e28d.tar.gz
cpython-879986d8a932c4524cb6ff822afc9537de16e28d.zip
bpo-43013: Fix old tkinter module names in idlelib (GH-24326)
Lowercase 'tkColorChooser', 'tkFileDialog', 'tkSimpleDialog', and 'tkMessageBox' and remove 'tk'. Just lowercase 'tkFont' as 'font' is already used. Adjust import.
Diffstat (limited to 'Lib/idlelib/idle_test/mock_tk.py')
-rw-r--r--Lib/idlelib/idle_test/mock_tk.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/idlelib/idle_test/mock_tk.py b/Lib/idlelib/idle_test/mock_tk.py
index b736bd001da..db583553838 100644
--- a/Lib/idlelib/idle_test/mock_tk.py
+++ b/Lib/idlelib/idle_test/mock_tk.py
@@ -59,27 +59,26 @@ class Mbox_func:
class Mbox:
"""Mock for tkinter.messagebox with an Mbox_func for each function.
- This module was 'tkMessageBox' in 2.x; hence the 'import as' in 3.x.
Example usage in test_module.py for testing functions in module.py:
---
from idlelib.idle_test.mock_tk import Mbox
import module
-orig_mbox = module.tkMessageBox
+orig_mbox = module.messagebox
showerror = Mbox.showerror # example, for attribute access in test methods
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
- module.tkMessageBox = Mbox
+ module.messagebox = Mbox
@classmethod
def tearDownClass(cls):
- module.tkMessageBox = orig_mbox
+ module.messagebox = orig_mbox
---
For 'ask' functions, set func.result return value before calling the method
- that uses the message function. When tkMessageBox functions are the
+ that uses the message function. When messagebox functions are the
only gui alls in a method, this replacement makes the method gui-free,
"""
askokcancel = Mbox_func() # True or False