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

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

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

trunk/esys2/escript/test/python/escriptTest.py revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC trunk/escript/test/python/escriptTest.py revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC
# Line 1  Line 1 
1    # $Id$
2    
3  import sys  import sys
4  import unittest  import unittest
5  import os  import os
6    
7  esys_root=os.getenv('ESYS_ROOT')  from esys.escript import *
8  sys.path.append(esys_root+'/finley/lib')  from esys import bruce
9  sys.path.append(esys_root+'/escript/lib')  from esys.escript.test_symbols import Test_symbols
10  sys.path.append(esys_root+'/escript/py_src')  from esys.escript.test_util import Test_util
   
11    
 import escript  
 import finley  
12  import numarray  import numarray
13    
14    class Test_symbols_OnBruce(Test_symbols):
15        def setUp(self):
16            self.domain = bruce.Brick(5,15,8)
17            self.functionspace=escript.ContinuousFunction(self.domain)
18    
19    class Test_util_OnBruce(Test_util):
20        def setUp(self):
21            self.domain = bruce.Brick(5,15,8)
22            self.functionspace=escript.ContinuousFunction(self.domain)
23    
24    
25  class escriptTestCase(unittest.TestCase):  class escriptTestCase(unittest.TestCase):
26    
27    def testPow(self):    def testPow(self):
28      """Test the pow function."""      """Test the pow function."""
29      myFuncSpac=escript.FunctionSpace()      myFuncSpac=escript.FunctionSpace()
30      myVector=numarray.array([[1,2],[3,4]])      myVector=numarray.array([[1,2],[3,4]])
31      myData=escript.Data(myVector,myFuncSpac,True)      myData=escript.Data(myVector,myFuncSpac,True)
32      print myData**3      print myData**3
33    
34    def testFunctionSpace(self):    def testFunctionSpace(self):
35        """Test the creation of FunctionSpace objects."""      """Test the creation of FunctionSpace objects."""
36        print      mesh=bruce.Brick(1,1,1)
37        mesh=finley.Brick(1,1,1,1,1.,1.,1.,1,1,1,1,1)      cFunc=escript.ContinuousFunction(mesh)
38        cFunc=escript.ContinuousFunction(mesh)  
39    def testDataOperations(self):    def testDataOperations(self):
40      """Test the operations that may be performed on Data."""      """Test the operations that may be performed on Data."""
41      myFuncSpac=escript.FunctionSpace()      myFuncSpac=escript.FunctionSpace()
# Line 52  class escriptTestCase(unittest.TestCase) Line 64  class escriptTestCase(unittest.TestCase)
64      print myData9      print myData9
65      print myData9.wherePositive()      print myData9.wherePositive()
66      print myData9.whereNegative()      print myData9.whereNegative()
 #  
 #   Lsup test for DataExpanded  
     assert (myData.Lsup()==4)  
     assert (myData.inf()==1)  
     assert (myData.Lsup()==myData.sup())  
     assert ((myData*-1).sup()!=(myData*-1).Lsup())  
 #  
 #   Lsup test for DataConstant  
     myData10=escript.Data(myVector,myFuncSpac,False)  
     myData11=-1.0*myData10  
     assert(myData10.Lsup()==myData11.Lsup())  
67            
68  suite=unittest.TestSuite()  suite = unittest.TestSuite()
69  suite.addTest(unittest.makeSuite(escriptTestCase))  suite.addTest(unittest.makeSuite(escriptTestCase))
70  unittest.TextTestRunner(verbosity=2).run(suite)  suite.addTest(unittest.makeSuite(Test_symbols_OnBruce))
71    suite.addTest(unittest.makeSuite(Test_util_OnBruce))
72    if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful():
73      sys.exit(0)
74    else:
75      sys.exit(1)

Legend:
Removed from v.82  
changed lines
  Added in v.155

  ViewVC Help
Powered by ViewVC 1.1.26