/[escript]/trunk/escript/test/python/test_objects.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_objects.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2712 by jfenwick, Fri Sep 18 05:33:10 2009 UTC revision 2713 by jfenwick, Wed Oct 7 00:35:06 2009 UTC
# Line 166  class Test_saveCSV(unittest.TestCase): Line 166  class Test_saveCSV(unittest.TestCase):
166      line=f.readline()      line=f.readline()
167      self.failUnless(line=='A_0_0, A_1_0, A_0_1, A_1_1, B_0_0_0, B_0_0_1, B_1_0_0, B_1_0_1, B_0_1_0, B_0_1_1, B_1_1_0, B_1_1_1, C_0_0_0_0, C_0_0_0_1, C_0_0_1_0, C_0_0_1_1, C_1_0_0_0, C_1_0_0_1, C_1_0_1_0, C_1_0_1_1, C_0_1_0_0, C_0_1_0_1, C_0_1_1_0, C_0_1_1_1, C_1_1_0_0, C_1_1_0_1, C_1_1_1_0, C_1_1_1_1\n')      self.failUnless(line=='A_0_0, A_1_0, A_0_1, A_1_1, B_0_0_0, B_0_0_1, B_1_0_0, B_1_0_1, B_0_1_0, B_0_1_1, B_1_1_0, B_1_1_1, C_0_0_0_0, C_0_0_0_1, C_0_0_1_0, C_0_0_1_1, C_1_0_0_0, C_1_0_0_1, C_1_0_1_0, C_1_0_1_1, C_0_1_0_0, C_0_1_0_1, C_0_1_1_0, C_0_1_1_1, C_1_1_0_0, C_1_1_0_1, C_1_1_1_0, C_1_1_1_1\n')
168      line=f.readline()      line=f.readline()
169      self.failUnless(line=='7.000000000000000e+00, 7.000000000000000e+00, 7.000000000000000e+00, 7.000000000000000e+00, 8.000000000000000e+00, 8.000000000000000e+00, 8.000000000000000e+00, 8.000000000000000e+00, 8.000000000000000e+00, 8.000000000000000e+00, 8.000000000000000e+00, 8.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00, 9.000000000000000e+00\n')      line_expected=[7.]*4+[8.]*8+[9.]*16
170        line_got=[float(elt) for elt in line.split(',')]
171        self.failUnless(line_got==line_expected)
172      linecount=1      linecount=1
173      while line != '':      while line != '':
174          linecount+=1          linecount+=1
# Line 174  class Test_saveCSV(unittest.TestCase): Line 176  class Test_saveCSV(unittest.TestCase):
176      self.failUnless(linecount!=self.linecount1)      self.failUnless(linecount!=self.linecount1)
177      f.close()        f.close()  
178      #Now to test separators and mask      #Now to test separators and mask
179      saveDataCSV(fname, sep="+",csep="/", U=X, V=X0, mask=X0)      saveDataCSV(fname, sep="|",csep="/", U=X, V=X0, mask=X0)
180      f=open(fname,'r')      f=open(fname,'r')
181      line=f.readline()      line=f.readline()
182      self.failUnless(line=='U/0+U/1+V\n')      self.failUnless(line=='U/0|U/1|V\n')
183      line=f.readline()      line=f.readline()
184      self.failUnless(line=='1.250000000000000e-01+0.000000000000000e+00+1.250000000000000e-01\n')      line_expected=[0.125, 0., 0.125]
185        line_got=[float(elt) for elt in line.split('|')]
186        self.failUnless(line_expected==line_got)
187      linecount=1      linecount=1
188      while line!='':      while line!='':
189          linecount+=1          linecount+=1

Legend:
Removed from v.2712  
changed lines
  Added in v.2713

  ViewVC Help
Powered by ViewVC 1.1.26