mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always
returns bool. tkinter.BooleanVar now validates input values (accepted bool, int, str, and Tcl_Obj). tkinter.BooleanVar.get() now always returns bool.
This commit is contained in:
parent
c9ba38c21c
commit
9a6e201f7d
6 changed files with 58 additions and 17 deletions
|
@ -181,7 +181,8 @@ class TclTest(unittest.TestCase):
|
|||
tcl = self.interp.tk
|
||||
self.assertIs(tcl.getboolean('on'), True)
|
||||
self.assertIs(tcl.getboolean('1'), True)
|
||||
self.assertEqual(tcl.getboolean(42), 42)
|
||||
self.assertIs(tcl.getboolean(42), True)
|
||||
self.assertIs(tcl.getboolean(0), False)
|
||||
self.assertRaises(TypeError, tcl.getboolean)
|
||||
self.assertRaises(TypeError, tcl.getboolean, 'on', '1')
|
||||
self.assertRaises(TypeError, tcl.getboolean, b'on')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue