MCPcopy Index your code
hub / github.com/python/cpython / test_askinteger

Method test_askinteger

Lib/test/test_tkinter/test_simpledialog.py:13–32  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

11class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
12
13 def test_askinteger(self):
14 @staticmethod
15 def mock_wait_window(w):
16 nonlocal ismapped
17 ismapped = w.master.winfo_ismapped()
18 w.destroy()
19
20 with swap_attr(Dialog, 'wait_window', mock_wait_window):
21 ismapped = None
22 askinteger("Go To Line", "Line number")
23 self.assertEqual(ismapped, False)
24
25 root = tkinter.Tk()
26 ismapped = None
27 askinteger("Go To Line", "Line number")
28 self.assertEqual(ismapped, True)
29 root.destroy()
30
31 tkinter.NoDefaultRoot()
32 self.assertRaises(RuntimeError, askinteger, "Go To Line", "Line number")
33
34
35if __name__ == "__main__":

Callers

nothing calls this directly

Calls 5

destroyMethod · 0.95
swap_attrFunction · 0.90
askintegerFunction · 0.90
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected