File: test_simpledialog.py

package info (click to toggle)
python3-stdlib-extensions 3.13.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,060 kB
  • sloc: python: 143,054; ansic: 66,791; makefile: 314; sh: 149
file content (23 lines) | stat: -rw-r--r-- 725 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import unittest
import tkinter
from test.support import requires, swap_attr
from tkinter.test.support import AbstractDefaultRootTest
from tkinter.simpledialog import Dialog, askinteger

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()):
            askinteger("Go To Line", "Line number")
        root.destroy()
        tkinter.NoDefaultRoot()
        self.assertRaises(RuntimeError, askinteger, "Go To Line", "Line number")


if __name__ == "__main__":
    unittest.main()