/[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 149 - (show annotations)
Thu Sep 1 03:31:39 2005 UTC (14 years, 2 months ago) by jgs
Original Path: trunk/esys2/escript/test/python/escriptTest.py
File MIME type: text/x-python
File size: 1792 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-01

1 # $Id$
2
3 import sys
4 import unittest
5 import os
6
7 from esys.escript import *
8 from esys import finley
9
10 import numarray
11
12 class escriptTestCase(unittest.TestCase):
13
14 def testPow(self):
15 """Test the pow function."""
16 myFuncSpac=escript.FunctionSpace()
17 myVector=numarray.array([[1,2],[3,4]])
18 myData=escript.Data(myVector,myFuncSpac,True)
19 print myData**3
20
21 def testFunctionSpace(self):
22 """Test the creation of FunctionSpace objects."""
23 mesh=finley.Brick(1,1,1,1,1.,1.,1.,1,1,1,1,1)
24 cFunc=escript.ContinuousFunction(mesh)
25
26 def testDataOperations(self):
27 """Test the operations that may be performed on Data."""
28 myFuncSpac=escript.FunctionSpace()
29 myVector=numarray.array([[1,2],[3,4]])
30 myData=escript.Data(myVector,myFuncSpac,True)
31 myData2=3+myData
32 print myData2
33 myList=[[1,2],[3,4]]
34 myData3=myList+myData
35 print myData3
36 myData3=myData+myData2+myData3
37 print myData3
38 myData4=myList-myData
39 print myData4
40 myData5=0-myData
41 print myData5
42 myData6=1/myData
43 print myData6
44 myData7=5*myData
45 print myData7
46 myData8=(3*myData)/3+2*myData-2*myData
47 print myData8
48 myData9=myData.sin()
49 print myData9
50 myData9=myData.cos()
51 print myData9
52 print myData9.wherePositive()
53 print myData9.whereNegative()
54 #
55 # Lsup test for DataExpanded
56 assert (myData.Lsup()==4)
57 assert (myData.inf()==1)
58 assert (myData.Lsup()==myData.sup())
59 assert ((myData*-1).sup()!=(myData*-1).Lsup())
60 #
61 # Lsup test for DataConstant
62 myData10=escript.Data(myVector,myFuncSpac,False)
63 myData11=-1.0*myData10
64 assert(myData10.Lsup()==myData11.Lsup())
65
66 suite=unittest.TestSuite()
67 suite.addTest(unittest.makeSuite(escriptTestCase))
68 unittest.TextTestRunner(verbosity=2).run(suite)
69
70 sys.exit(0)

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26