/[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 3258 by jfenwick, Thu Jan 28 02:03:15 2010 UTC revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC
# Line 25  Test suite for data objects. at the mome Line 25  Test suite for data objects. at the mome
25  The tests must be linked with some function space class object in the setUp method:  The tests must be linked with some function space class object in the setUp method:
26  to run the use:  to run the use:
27    
28     from esys.finley import Brick     from esys.dudley import Brick
29     class Test_DumpOnFinley(Test_Dump):     class Test_DumpOnDudley(Test_Dump):
30         def setUp(self):         def setUp(self):
31            self.domain =Rectangle(NE,NE+1,2)            self.domain =Rectangle(NE,NE+1,2)
32            self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)            self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
# Line 35  to run the use: Line 35  to run the use:
35            self.filename_base="."            self.filename_base="."
36    
37     suite = unittest.TestSuite()     suite = unittest.TestSuite()
38     suite.addTest(unittest.makeSuite(Test_DumpOnFinley))     suite.addTest(unittest.makeSuite(Test_DumpOnDudley))
39     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
40    
41  :var __author__: name of author  :var __author__: name of author
# Line 153  class Test_saveCSV(unittest.TestCase): Line 153  class Test_saveCSV(unittest.TestCase):
153      while line != '':      while line != '':
154          linecount+=1          linecount+=1
155          line=f.readline()          line=f.readline()
156      self.failUnless(linecount!=self.linecount1*2)      self.failUnless(linecount==self.linecount1*2)
157      f.close()      f.close()
158      #Now to other output      #Now to other output
159      T2=Tensor(7,X.getFunctionSpace())      T2=Tensor(7,X.getFunctionSpace())
# Line 171  class Test_saveCSV(unittest.TestCase): Line 171  class Test_saveCSV(unittest.TestCase):
171      while line != '':      while line != '':
172          linecount+=1          linecount+=1
173          line=f.readline()          line=f.readline()
174      self.failUnless(linecount!=self.linecount1)      self.failUnless(linecount==self.linecount1)
175      f.close()        f.close()  
176      #Now to test separators and mask      #Now to test separators and mask
177      saveDataCSV(fname, sep="|",csep="/", U=X, V=X0, mask=X0)      saveDataCSV(fname, sep="|",csep="/", U=X, V=X0, mask=X0)
# Line 179  class Test_saveCSV(unittest.TestCase): Line 179  class Test_saveCSV(unittest.TestCase):
179      line=f.readline()      line=f.readline()
180      self.failUnless(line=='U/0|U/1|V\n')      self.failUnless(line=='U/0|U/1|V\n')
181      line=f.readline()      line=f.readline()
     line_expected=[0.125, 0., 0.125]  
182      line_got=[float(elt) for elt in line.split('|')]      line_got=[float(elt) for elt in line.split('|')]
183      self.failUnless(line_expected==line_got)      self.failUnless(self.line_expected==line_got)
184      linecount=1      linecount=1
185      while line!='':      while line!='':
186          linecount+=1          linecount+=1

Legend:
Removed from v.3258  
changed lines
  Added in v.3259

  ViewVC Help
Powered by ViewVC 1.1.26