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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 11 months ago) by jgs
File MIME type: text/x-python
File size: 2016 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 # $Id$
2
3 import sys
4 import unittest
5 import os
6
7 from esys.escript import *
8 from esys import bruce
9 from esys.escript.test_symbols import Test_symbols
10 from esys.escript.test_util import Test_util
11
12 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):
26
27 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
34 def testFunctionSpace(self):
35 """Test the creation of FunctionSpace objects."""
36 mesh=bruce.Brick(1,1,1)
37 cFunc=escript.ContinuousFunction(mesh)
38
39 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 suite = unittest.TestSuite()
69 suite.addTest(unittest.makeSuite(escriptTestCase))
70 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