aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/idlelib/idle_test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r--Lib/idlelib/idle_test/mock_tk.py9
-rw-r--r--Lib/idlelib/idle_test/test_configdialog.py8
-rw-r--r--Lib/idlelib/idle_test/test_replace.py6
-rw-r--r--Lib/idlelib/idle_test/test_searchengine.py6
-rw-r--r--Lib/idlelib/idle_test/test_squeezer.py4
5 files changed, 16 insertions, 17 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
diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
index 1fea6d41df8..98ddc67afdc 100644
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -423,7 +423,7 @@ class HighPageTest(unittest.TestCase):
def test_color(self):
d = self.page
d.on_new_color_set = Func()
- # self.color is only set in get_color through ColorChooser.
+ # self.color is only set in get_color through colorchooser.
d.color.set('green')
self.assertEqual(d.on_new_color_set.called, 1)
del d.on_new_color_set
@@ -540,8 +540,8 @@ class HighPageTest(unittest.TestCase):
def test_get_color(self):
eq = self.assertEqual
d = self.page
- orig_chooser = configdialog.tkColorChooser.askcolor
- chooser = configdialog.tkColorChooser.askcolor = Func()
+ orig_chooser = configdialog.colorchooser.askcolor
+ chooser = configdialog.colorchooser.askcolor = Func()
gntn = d.get_new_theme_name = Func()
d.highlight_target.set('Editor Breakpoint')
@@ -582,7 +582,7 @@ class HighPageTest(unittest.TestCase):
eq(d.color.get(), '#de0000')
del d.get_new_theme_name
- configdialog.tkColorChooser.askcolor = orig_chooser
+ configdialog.colorchooser.askcolor = orig_chooser
def test_on_new_color_set(self):
d = self.page
diff --git a/Lib/idlelib/idle_test/test_replace.py b/Lib/idlelib/idle_test/test_replace.py
index c3c5d2eeb94..6c07389b29a 100644
--- a/Lib/idlelib/idle_test/test_replace.py
+++ b/Lib/idlelib/idle_test/test_replace.py
@@ -10,7 +10,7 @@ from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se
-orig_mbox = se.tkMessageBox
+orig_mbox = se.messagebox
showerror = Mbox.showerror
@@ -20,7 +20,7 @@ class ReplaceDialogTest(unittest.TestCase):
def setUpClass(cls):
cls.root = Tk()
cls.root.withdraw()
- se.tkMessageBox = Mbox
+ se.messagebox = Mbox
cls.engine = se.SearchEngine(cls.root)
cls.dialog = ReplaceDialog(cls.root, cls.engine)
cls.dialog.bell = lambda: None
@@ -32,7 +32,7 @@ class ReplaceDialogTest(unittest.TestCase):
@classmethod
def tearDownClass(cls):
- se.tkMessageBox = orig_mbox
+ se.messagebox = orig_mbox
del cls.text, cls.dialog, cls.engine
cls.root.destroy()
del cls.root
diff --git a/Lib/idlelib/idle_test/test_searchengine.py b/Lib/idlelib/idle_test/test_searchengine.py
index f8401ce9380..9d979839419 100644
--- a/Lib/idlelib/idle_test/test_searchengine.py
+++ b/Lib/idlelib/idle_test/test_searchengine.py
@@ -4,7 +4,7 @@ from idlelib import searchengine as se
import unittest
# from test.support import requires
from tkinter import BooleanVar, StringVar, TclError # ,Tk, Text
-import tkinter.messagebox as tkMessageBox
+from tkinter import messagebox
from idlelib.idle_test.mock_tk import Var, Mbox
from idlelib.idle_test.mock_tk import Text as mockText
import re
@@ -19,13 +19,13 @@ def setUpModule():
# Replace s-e module tkinter imports other than non-gui TclError.
se.BooleanVar = Var
se.StringVar = Var
- se.tkMessageBox = Mbox
+ se.messagebox = Mbox
def tearDownModule():
# Restore 'just in case', though other tests should also replace.
se.BooleanVar = BooleanVar
se.StringVar = StringVar
- se.tkMessageBox = tkMessageBox
+ se.messagebox = messagebox
class Mock:
diff --git a/Lib/idlelib/idle_test/test_squeezer.py b/Lib/idlelib/idle_test/test_squeezer.py
index e3912f4bbbe..ee1bbd76b50 100644
--- a/Lib/idlelib/idle_test/test_squeezer.py
+++ b/Lib/idlelib/idle_test/test_squeezer.py
@@ -396,7 +396,7 @@ class ExpandingButtonTest(unittest.TestCase):
expandingbutton.base_text = expandingbutton.text
# Patch the message box module to always return False.
- with patch('idlelib.squeezer.tkMessageBox') as mock_msgbox:
+ with patch('idlelib.squeezer.messagebox') as mock_msgbox:
mock_msgbox.askokcancel.return_value = False
mock_msgbox.askyesno.return_value = False
# Trigger the expand event.
@@ -407,7 +407,7 @@ class ExpandingButtonTest(unittest.TestCase):
self.assertEqual(expandingbutton.text.get('1.0', 'end-1c'), '')
# Patch the message box module to always return True.
- with patch('idlelib.squeezer.tkMessageBox') as mock_msgbox:
+ with patch('idlelib.squeezer.messagebox') as mock_msgbox:
mock_msgbox.askokcancel.return_value = True
mock_msgbox.askyesno.return_value = True
# Trigger the expand event.