Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_tcl.TclTest Class Reference

List of all members.

Public Member Functions

def setUp
def testEval
def testEvalException
def testEvalException2
def testCall
def testCallException
def testCallException2
def testSetVar
def testSetVarArray
def testGetVar
def testGetVarArray
def testGetVarException
def testGetVarArrayException
def testUnsetVar
def testUnsetVarArray
def testUnsetVarException
def testEvalFile
def testEvalFileException
def testPackageRequireException
def testLoadWithUNC

Public Attributes

 interp

Detailed Description

Definition at line 22 of file test_tcl.py.


Member Function Documentation

Definition at line 24 of file test_tcl.py.

00024 
00025     def setUp(self):
00026         self.interp = Tcl()

Here is the caller graph for this function:

Definition at line 40 of file test_tcl.py.

00040 
00041     def testCall(self):
00042         tcl = self.interp
00043         tcl.call('set','a','1')
00044         self.assertEqual(tcl.call('set','a'),'1')

Here is the call graph for this function:

Definition at line 45 of file test_tcl.py.

00045 
00046     def testCallException(self):
00047         tcl = self.interp
00048         self.assertRaises(TclError,tcl.call,'set','a')

Here is the call graph for this function:

Definition at line 49 of file test_tcl.py.

00049 
00050     def testCallException2(self):
00051         tcl = self.interp
00052         self.assertRaises(TclError,tcl.call,'this','is','wrong')

Here is the call graph for this function:

Definition at line 27 of file test_tcl.py.

00027 
00028     def testEval(self):
00029         tcl = self.interp
00030         tcl.eval('set a 1')
00031         self.assertEqual(tcl.eval('set a'),'1')

Here is the call graph for this function:

Definition at line 32 of file test_tcl.py.

00032 
00033     def testEvalException(self):
00034         tcl = self.interp
00035         self.assertRaises(TclError,tcl.eval,'set a')

Here is the call graph for this function:

Definition at line 36 of file test_tcl.py.

00036 
00037     def testEvalException2(self):
00038         tcl = self.interp
00039         self.assertRaises(TclError,tcl.eval,'this is wrong')

Here is the call graph for this function:

Definition at line 102 of file test_tcl.py.

00102 
00103     def testEvalFile(self):
00104         tcl = self.interp
00105         filename = "testEvalFile.tcl"
00106         fd = open(filename,'w')
00107         script = """set a 1
00108         set b 2
00109         set c [ expr $a + $b ]
00110         """
00111         fd.write(script)
00112         fd.close()
00113         tcl.evalfile(filename)
00114         os.remove(filename)
00115         self.assertEqual(tcl.eval('set a'),'1')
00116         self.assertEqual(tcl.eval('set b'),'2')
00117         self.assertEqual(tcl.eval('set c'),'3')

Here is the call graph for this function:

Definition at line 118 of file test_tcl.py.

00118 
00119     def testEvalFileException(self):
00120         tcl = self.interp
00121         filename = "doesnotexists"
00122         try:
00123             os.remove(filename)
00124         except Exception as e:
00125             pass
00126         self.assertRaises(TclError,tcl.evalfile,filename)

Here is the call graph for this function:

Definition at line 63 of file test_tcl.py.

00063 
00064     def testGetVar(self):
00065         tcl = self.interp
00066         tcl.eval('set a 1')
00067         self.assertEqual(tcl.getvar('a'),'1')

Here is the call graph for this function:

Definition at line 68 of file test_tcl.py.

00068 
00069     def testGetVarArray(self):
00070         tcl = self.interp
00071         tcl.eval('set a(1) 1')
00072         self.assertEqual(tcl.getvar('a(1)'),'1')

Here is the call graph for this function:

Definition at line 77 of file test_tcl.py.

00077 
00078     def testGetVarArrayException(self):
00079         tcl = self.interp
00080         self.assertRaises(TclError,tcl.getvar,'a(1)')

Here is the call graph for this function:

Definition at line 73 of file test_tcl.py.

00073 
00074     def testGetVarException(self):
00075         tcl = self.interp
00076         self.assertRaises(TclError,tcl.getvar,'a')

Here is the call graph for this function:

Definition at line 132 of file test_tcl.py.

00132 
00133     def testLoadWithUNC(self):
00134         # Build a UNC path from the regular path.
00135         # Something like
00136         #   \\%COMPUTERNAME%\c$\python27\python.exe
00137 
00138         fullname = os.path.abspath(sys.executable)
00139         if fullname[1] != ':':
00140             raise unittest.SkipTest('Absolute path should have drive part')
00141         unc_name = r'\\%s\%s$\%s' % (os.environ['COMPUTERNAME'],
00142                                     fullname[0],
00143                                     fullname[3:])
00144         if not os.path.exists(unc_name):
00145             raise unittest.SkipTest('Cannot connect to UNC Path')
00146 
00147         with support.EnvironmentVarGuard() as env:
00148             env.unset("TCL_LIBRARY")
00149             f = os.popen('%s -c "import tkinter; print(tkinter)"' % (unc_name,))
00150 
00151         self.assertIn('tkinter', f.read())
00152         # exit code must be zero
00153         self.assertEqual(f.close(), None)
00154 
00155 

Here is the call graph for this function:

Definition at line 127 of file test_tcl.py.

00127 
00128     def testPackageRequireException(self):
00129         tcl = self.interp
00130         self.assertRaises(TclError,tcl.eval,'package require DNE')

Here is the call graph for this function:

Definition at line 53 of file test_tcl.py.

00053 
00054     def testSetVar(self):
00055         tcl = self.interp
00056         tcl.setvar('a','1')
00057         self.assertEqual(tcl.eval('set a'),'1')

Here is the call graph for this function:

Definition at line 58 of file test_tcl.py.

00058 
00059     def testSetVarArray(self):
00060         tcl = self.interp
00061         tcl.setvar('a(1)','1')
00062         self.assertEqual(tcl.eval('set a(1)'),'1')

Here is the call graph for this function:

Definition at line 81 of file test_tcl.py.

00081 
00082     def testUnsetVar(self):
00083         tcl = self.interp
00084         tcl.setvar('a',1)
00085         self.assertEqual(tcl.eval('info exists a'),'1')
00086         tcl.unsetvar('a')
00087         self.assertEqual(tcl.eval('info exists a'),'0')

Here is the call graph for this function:

Definition at line 88 of file test_tcl.py.

00088 
00089     def testUnsetVarArray(self):
00090         tcl = self.interp
00091         tcl.setvar('a(1)',1)
00092         tcl.setvar('a(2)',2)
00093         self.assertEqual(tcl.eval('info exists a(1)'),'1')
00094         self.assertEqual(tcl.eval('info exists a(2)'),'1')
00095         tcl.unsetvar('a(1)')
00096         self.assertEqual(tcl.eval('info exists a(1)'),'0')
00097         self.assertEqual(tcl.eval('info exists a(2)'),'1')

Here is the call graph for this function:

Definition at line 98 of file test_tcl.py.

00098 
00099     def testUnsetVarException(self):
00100         tcl = self.interp
00101         self.assertRaises(TclError,tcl.unsetvar,'a')

Here is the call graph for this function:


Member Data Documentation

Definition at line 25 of file test_tcl.py.


The documentation for this class was generated from the following file: