@@ -133,6 +133,50 @@ def testUnsetVarException(self):
133133 tcl = self .interp
134134 self .assertRaises (TclError ,tcl .unsetvar ,'a' )
135135
136+ def test_getint (self ):
137+ tcl = self .interp .tk
138+ self .assertEqual (tcl .getint (' 42 ' ), 42 )
139+ self .assertEqual (tcl .getint (42 ), 42 )
140+ self .assertRaises (TypeError , tcl .getint )
141+ self .assertRaises (TypeError , tcl .getint , '42' , '10' )
142+ self .assertRaises (TypeError , tcl .getint , b'42' )
143+ self .assertRaises (TypeError , tcl .getint , 42.0 )
144+ self .assertRaises (TclError , tcl .getint , 'a' )
145+ self .assertRaises ((TypeError , ValueError , TclError ),
146+ tcl .getint , '42\0 ' )
147+ self .assertRaises ((UnicodeEncodeError , ValueError , TclError ),
148+ tcl .getint , '42\ud800 ' )
149+
150+ def test_getdouble (self ):
151+ tcl = self .interp .tk
152+ self .assertEqual (tcl .getdouble (' 42 ' ), 42.0 )
153+ self .assertEqual (tcl .getdouble (' 42.5 ' ), 42.5 )
154+ self .assertEqual (tcl .getdouble (42.5 ), 42.5 )
155+ self .assertRaises (TypeError , tcl .getdouble )
156+ self .assertRaises (TypeError , tcl .getdouble , '42.5' , '10' )
157+ self .assertRaises (TypeError , tcl .getdouble , b'42.5' )
158+ self .assertRaises (TypeError , tcl .getdouble , 42 )
159+ self .assertRaises (TclError , tcl .getdouble , 'a' )
160+ self .assertRaises ((TypeError , ValueError , TclError ),
161+ tcl .getdouble , '42.5\0 ' )
162+ self .assertRaises ((UnicodeEncodeError , ValueError , TclError ),
163+ tcl .getdouble , '42.5\ud800 ' )
164+
165+ def test_getboolean (self ):
166+ tcl = self .interp .tk
167+ self .assertIs (tcl .getboolean ('on' ), True )
168+ self .assertIs (tcl .getboolean ('1' ), True )
169+ self .assertEqual (tcl .getboolean (42 ), 42 )
170+ self .assertRaises (TypeError , tcl .getboolean )
171+ self .assertRaises (TypeError , tcl .getboolean , 'on' , '1' )
172+ self .assertRaises (TypeError , tcl .getboolean , b'on' )
173+ self .assertRaises (TypeError , tcl .getboolean , 1.0 )
174+ self .assertRaises (TclError , tcl .getboolean , 'a' )
175+ self .assertRaises ((TypeError , ValueError , TclError ),
176+ tcl .getboolean , 'on\0 ' )
177+ self .assertRaises ((UnicodeEncodeError , ValueError , TclError ),
178+ tcl .getboolean , 'on\ud800 ' )
179+
136180 def testEvalFile (self ):
137181 tcl = self .interp
138182 with open (support .TESTFN , 'w' ) as f :
0 commit comments