• Home
  • Raw
  • Download

Lines Matching refs:tcl

26         tcl = Tcl()
27 patchlevel = tcl.call('info', 'patchlevel')
53 tcl = self.interp
54 tcl.eval('set a 1')
55 self.assertEqual(tcl.eval('set a'),'1')
58 tcl = self.interp
59 self.assertRaises(TclError,tcl.eval,'set a')
62 tcl = self.interp
63 self.assertRaises(TclError,tcl.eval,'this is wrong')
66 tcl = self.interp
67 tcl.call('set','a','1')
68 self.assertEqual(tcl.call('set','a'),'1')
71 tcl = self.interp
72 self.assertRaises(TclError,tcl.call,'set','a')
75 tcl = self.interp
76 self.assertRaises(TclError,tcl.call,'this','is','wrong')
79 tcl = self.interp
80 tcl.setvar('a','1')
81 self.assertEqual(tcl.eval('set a'),'1')
84 tcl = self.interp
85 tcl.setvar('a(1)','1')
86 self.assertEqual(tcl.eval('set a(1)'),'1')
89 tcl = self.interp
90 tcl.eval('set a 1')
91 self.assertEqual(tcl.getvar('a'),'1')
94 tcl = self.interp
95 tcl.eval('set a(1) 1')
96 self.assertEqual(tcl.getvar('a(1)'),'1')
99 tcl = self.interp
100 self.assertRaises(TclError,tcl.getvar,'a')
103 tcl = self.interp
104 self.assertRaises(TclError,tcl.getvar,'a(1)')
107 tcl = self.interp
108 tcl.setvar('a',1)
109 self.assertEqual(tcl.eval('info exists a'),'1')
110 tcl.unsetvar('a')
111 self.assertEqual(tcl.eval('info exists a'),'0')
114 tcl = self.interp
115 tcl.setvar('a(1)',1)
116 tcl.setvar('a(2)',2)
117 self.assertEqual(tcl.eval('info exists a(1)'),'1')
118 self.assertEqual(tcl.eval('info exists a(2)'),'1')
119 tcl.unsetvar('a(1)')
120 self.assertEqual(tcl.eval('info exists a(1)'),'0')
121 self.assertEqual(tcl.eval('info exists a(2)'),'1')
124 tcl = self.interp
125 self.assertRaises(TclError,tcl.unsetvar,'a')
138 tcl = self.interp.tk
140 result = tcl.getint(' %d ' % i)
144 self.assertEqual(tcl.getint(' {:#o} '.format(i)), i)
145 self.assertEqual(tcl.getint(' %#o ' % i), i)
146 self.assertEqual(tcl.getint(' %#x ' % i), i)
148 self.assertRaises(TclError, tcl.getint, str(2**1000))
149 self.assertEqual(tcl.getint(42), 42)
150 self.assertRaises(TypeError, tcl.getint)
151 self.assertRaises(TypeError, tcl.getint, '42', '10')
152 self.assertRaises(TypeError, tcl.getint, 42.0)
153 self.assertRaises(TclError, tcl.getint, 'a')
155 tcl.getint, '42\0')
157 self.assertEqual(tcl.getint(unicode('42')), 42)
159 tcl.getint, '42' + unichr(0xd800))
162 tcl = self.interp.tk
163 self.assertEqual(tcl.getdouble(' 42 '), 42.0)
164 self.assertEqual(tcl.getdouble(' 42.5 '), 42.5)
165 self.assertEqual(tcl.getdouble(42.5), 42.5)
166 self.assertRaises(TypeError, tcl.getdouble)
167 self.assertRaises(TypeError, tcl.getdouble, '42.5', '10')
168 self.assertRaises(TypeError, tcl.getdouble, 42)
169 self.assertRaises(TclError, tcl.getdouble, 'a')
171 tcl.getdouble, '42.5\0')
173 self.assertEqual(tcl.getdouble(unicode('42.5')), 42.5)
175 tcl.getdouble, '42.5' + unichr(0xd800))
178 tcl = self.interp.tk
179 self.assertIs(tcl.getboolean('on'), True)
180 self.assertIs(tcl.getboolean('1'), True)
181 self.assertIs(tcl.getboolean(u'on'), True)
182 self.assertIs(tcl.getboolean(u'1'), True)
183 self.assertIs(tcl.getboolean(42), True)
184 self.assertIs(tcl.getboolean(0), False)
185 self.assertIs(tcl.getboolean(42L), True)
186 self.assertIs(tcl.getboolean(0L), False)
187 self.assertRaises(TypeError, tcl.getboolean)
188 self.assertRaises(TypeError, tcl.getboolean, 'on', '1')
189 self.assertRaises(TypeError, tcl.getboolean, 1.0)
190 self.assertRaises(TclError, tcl.getboolean, 'a')
192 tcl.getboolean, 'on\0')
194 self.assertIs(tcl.getboolean(unicode('on')), True)
196 tcl.getboolean, 'on' + unichr(0xd800))
199 tcl = self.interp
208 tcl.evalfile(filename)
210 self.assertEqual(tcl.eval('set a'),'1')
211 self.assertEqual(tcl.eval('set b'),'2')
212 self.assertEqual(tcl.eval('set c'),'3')
215 tcl = self.interp
222 tcl.evalfile(test_support.TESTFN)
223 self.assertEqual(tcl.eval('set a'), 'a\xc0\x80b')
224 self.assertEqual(tcl.eval('set b'), 'a\xc0\x80b')
227 tcl = self.interp
233 self.assertRaises(TclError,tcl.evalfile,filename)
236 tcl = self.interp
237 self.assertRaises(TclError,tcl.eval,'package require DNE')
277 tcl = self.interp
278 tcl.call('set', 'a', 3)
279 tcl.call('set', 'b', 6)
281 result = tcl.exprstring(expr)
285 self.assertRaises(TypeError, tcl.exprstring)
286 self.assertRaises(TypeError, tcl.exprstring, '8.2', '+6')
287 self.assertRaises(TclError, tcl.exprstring, 'spam')
311 tcl = self.interp
312 tcl.call('set', 'a', 3)
313 tcl.call('set', 'b', 6)
315 result = tcl.exprdouble(expr)
319 self.assertRaises(TypeError, tcl.exprdouble)
320 self.assertRaises(TypeError, tcl.exprdouble, '8.2', '+6')
321 self.assertRaises(TclError, tcl.exprdouble, 'spam')
337 self.assertRaises(TclError, tcl.exprdouble, '"abc"')
342 tcl = self.interp
343 tcl.call('set', 'a', 3)
344 tcl.call('set', 'b', 6)
346 result = tcl.exprlong(expr)
350 self.assertRaises(TypeError, tcl.exprlong)
351 self.assertRaises(TypeError, tcl.exprlong, '8.2', '+6')
352 self.assertRaises(TclError, tcl.exprlong, 'spam')
368 self.assertRaises(TclError, tcl.exprlong, '"abc"')
370 self.assertRaises(TclError, tcl.exprlong, '2**64')
373 tcl = self.interp
374 tcl.call('set', 'a', 3)
375 tcl.call('set', 'b', 6)
377 result = tcl.exprboolean(expr)
382 self.assertRaises(TypeError, tcl.exprboolean)
383 self.assertRaises(TypeError, tcl.exprboolean, '8.2', '+6')
384 self.assertRaises(TclError, tcl.exprboolean, 'spam')
408 self.assertRaises(TclError, tcl.exprboolean, '"abc"')
414 tcl = self.interp
416 result = tcl.call('expr', expr)
417 if tcl.wantobjects():
433 tcl = self.interp
435 result = tcl.call('expr', str(i))
445 self.assertRaises(TclError, tcl.call, 'expr', str(2**1000))
631 tcl = self.interp.tk
634 self.assertEqual(splitdict(tcl, arg, False),
636 self.assertEqual(splitdict(tcl, arg),
640 self.assertEqual(splitdict(tcl, arg, False),
642 self.assertEqual(splitdict(tcl, arg),
645 self.assertRaises(RuntimeError, splitdict, tcl, '-a b -c ')
646 self.assertRaises(RuntimeError, splitdict, tcl, ('-a', 'b', '-c'))
648 arg = tcl.call('list',
650 self.assertEqual(splitdict(tcl, arg),
655 arg = tcl.call('dict', 'create',
662 self.assertEqual(splitdict(tcl, arg), expected)
666 tcl = self.interp.tk
668 return tcl.call('lindex', s, 0)
768 tcl = Tcl()
769 print 'patchlevel =', tcl.call('info', 'patchlevel')