summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/test_tkinter/test_simpledialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tkinter/test/test_tkinter/test_simpledialog.py')
-rw-r--r--Lib/tkinter/test/test_tkinter/test_simpledialog.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_simpledialog.py b/Lib/tkinter/test/test_tkinter/test_simpledialog.py
index 9119172..b64b854 100644
--- a/Lib/tkinter/test/test_tkinter/test_simpledialog.py
+++ b/Lib/tkinter/test/test_tkinter/test_simpledialog.py
@@ -10,13 +10,25 @@ requires('gui')
class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
def test_askinteger(self):
- self.assertRaises(RuntimeError, askinteger, "Go To Line", "Line number")
- root = tkinter.Tk()
- with swap_attr(Dialog, 'wait_window', lambda self, w: w.destroy()):
+ @staticmethod
+ def mock_wait_window(w):
+ nonlocal ismapped
+ ismapped = w.master.winfo_ismapped()
+ w.destroy()
+
+ with swap_attr(Dialog, 'wait_window', mock_wait_window):
+ ismapped = None
+ askinteger("Go To Line", "Line number")
+ self.assertEqual(ismapped, False)
+
+ root = tkinter.Tk()
+ ismapped = None
askinteger("Go To Line", "Line number")
- root.destroy()
- tkinter.NoDefaultRoot()
- self.assertRaises(RuntimeError, askinteger, "Go To Line", "Line number")
+ self.assertEqual(ismapped, True)
+ root.destroy()
+
+ tkinter.NoDefaultRoot()
+ self.assertRaises(RuntimeError, askinteger, "Go To Line", "Line number")
tests_gui = (DefaultRootTest,)