mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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.
This commit is contained in:
parent
cf19cc3b92
commit
879986d8a9
13 changed files with 66 additions and 67 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue