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

Method test_askcolor

Lib/test/test_tkinter/test_colorchooser.py:45–65  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

43class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
44
45 def test_askcolor(self):
46 def test_callback(dialog, master):
47 nonlocal ismapped
48 master.update()
49 ismapped = master.winfo_ismapped()
50 raise ZeroDivisionError
51
52 with swap_attr(Dialog, '_test_callback', test_callback):
53 ismapped = None
54 self.assertRaises(ZeroDivisionError, askcolor)
55 #askcolor()
56 self.assertEqual(ismapped, False)
57
58 root = tkinter.Tk()
59 ismapped = None
60 self.assertRaises(ZeroDivisionError, askcolor)
61 self.assertEqual(ismapped, True)
62 root.destroy()
63
64 tkinter.NoDefaultRoot()
65 self.assertRaises(RuntimeError, askcolor)
66
67
68if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected