mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-39388: IDLE: Fix bug when cancelling out of configdialog (GH-18068)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
9017e0bd5e
commit
d0d9fa8c5e
4 changed files with 19 additions and 8 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue