summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-01-25 09:17:54 (GMT)
committerGitHub <noreply@github.com>2020-01-25 09:17:54 (GMT)
commita23449285430081ea317cc1f203c80c410bbd8b9 (patch)
tree9d0fd806658f42c0856838bb874ce5439949ec3e /Lib/idlelib/idle_test
parentea4a61fec842c94107eef46e5030b89a086f94bb (diff)
downloadcpython-a23449285430081ea317cc1f203c80c410bbd8b9.zip
cpython-a23449285430081ea317cc1f203c80c410bbd8b9.tar.gz
cpython-a23449285430081ea317cc1f203c80c410bbd8b9.tar.bz2
bpo-39388: IDLE: Fix bug when cancelling out of configdialog (GH-18068)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> (cherry picked from commit d0d9fa8c5e30aff71b6d5e8b2673396622f33270) Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r--Lib/idlelib/idle_test/test_configdialog.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
index 7c575d0..817a3521 100644
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -47,17 +47,24 @@ def tearDownModule():
root.destroy()
root = dialog = None
-class ConfigDialogTest(unittest.TestCase):
- def test_help(self):
+class DialogTest(unittest.TestCase):
+
+ @mock.patch(__name__+'.dialog.destroy', new_callable=Func)
+ def test_cancel(self, destroy):
+ changes['main']['something'] = 1
+ dialog.cancel()
+ self.assertEqual(changes['main'], {})
+ self.assertEqual(destroy.called, 1)
+
+ @mock.patch('idlelib.configdialog.view_text', new_callable=Func)
+ def test_help(self, view):
dialog.note.select(dialog.keyspage)
- saved = configdialog.view_text
- view = configdialog.view_text = Func()
dialog.help()
s = view.kwds['contents']
- self.assertTrue(s.startswith('When you click'))
- self.assertTrue(s.endswith('a different name.\n'))
- configdialog.view_text = saved
+ self.assertTrue(s.startswith('When you click') and
+ s.endswith('a different name.\n'))
+
class FontPageTest(unittest.TestCase):
"""Test that font widgets enable users to make font changes.