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:
Serhiy Storchaka 2015-04-04 12:43:01 +03:00
parent c9ba38c21c
commit 9a6e201f7d
6 changed files with 58 additions and 17 deletions

View file

@ -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')