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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 154 - (hide annotations)
Mon Nov 7 05:51:17 2005 UTC (15 years, 3 months ago) by jgs
Original Path: trunk/esys2/escript/test/python/escriptTest.py
File MIME type: text/x-python
File size: 2016 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-11-07

1 jgs 102 # $Id$
2    
3 jgs 82 import sys
4     import unittest
5     import os
6    
7 jgs 149 from esys.escript import *
8 jgs 153 from esys import bruce
9 jgs 154 from esys.escript.test_symbols import Test_symbols
10     from esys.escript.test_util import Test_util
11 jgs 82
12     import numarray
13    
14 jgs 154 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 jgs 82 class escriptTestCase(unittest.TestCase):
26 jgs 147
27 jgs 82 def testPow(self):
28     """Test the pow function."""
29     myFuncSpac=escript.FunctionSpace()
30     myVector=numarray.array([[1,2],[3,4]])
31     myData=escript.Data(myVector,myFuncSpac,True)
32     print myData**3
33 jgs 147
34 jgs 82 def testFunctionSpace(self):
35 jgs 147 """Test the creation of FunctionSpace objects."""
36 jgs 153 mesh=bruce.Brick(1,1,1)
37 jgs 147 cFunc=escript.ContinuousFunction(mesh)
38    
39 jgs 82 def testDataOperations(self):
40     """Test the operations that may be performed on Data."""
41     myFuncSpac=escript.FunctionSpace()
42     myVector=numarray.array([[1,2],[3,4]])
43     myData=escript.Data(myVector,myFuncSpac,True)
44     myData2=3+myData
45     print myData2
46     myList=[[1,2],[3,4]]
47     myData3=myList+myData
48     print myData3
49     myData3=myData+myData2+myData3
50     print myData3
51     myData4=myList-myData
52     print myData4
53     myData5=0-myData
54     print myData5
55     myData6=1/myData
56     print myData6
57     myData7=5*myData
58     print myData7
59     myData8=(3*myData)/3+2*myData-2*myData
60     print myData8
61     myData9=myData.sin()
62     print myData9
63     myData9=myData.cos()
64     print myData9
65     print myData9.wherePositive()
66     print myData9.whereNegative()
67    
68 jgs 154 suite = unittest.TestSuite()
69 jgs 82 suite.addTest(unittest.makeSuite(escriptTestCase))
70 jgs 154 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)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26