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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (hide annotations)
Wed Dec 15 07:08:39 2004 UTC (16 years, 4 months ago) by jgs
File MIME type: text/x-python
File size: 1798 byte(s)
*** empty log message ***

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26