/[escript]/trunk/finley/test/python/test_utilframe.py
ViewVC logotype

Contents of /trunk/finley/test/python/test_utilframe.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 618 - (show annotations)
Wed Mar 22 04:02:38 2006 UTC (13 years, 5 months ago) by gross
File MIME type: text/x-python
File size: 2021 byte(s)
mmio moced to paso
1 # $Id:$
2 """
3 frame to ran a single test out of the Test_util suite
4 """
5
6 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
7 http://www.access.edu.au
8 Primary Business: Queensland, Australia"""
9 __license__="""Licensed under the Open Software License version 3.0
10 http://www.opensource.org/licenses/osl-3.0.php"""
11 import unittest
12 from esys.escript import *
13 from esys.finley import Rectangle
14 import numarray
15
16 class Test_util2(unittest.TestCase):
17 RES_TOL=1.e-7
18 def setUp(self):
19 self.__dom =Rectangle(10,10,2)
20 self.functionspace = FunctionOnBoundary(self.__dom) # due to a bug in escript python needs to hold a reference to the domain
21 def itest_add_overloaded_constData_rank1_taggedData_rank0(self):
22 arg0=Data(numarray.array([4.5897569702707663, 3.4489828945022865]),self.functionspace)
23 arg1=Data(0.812494849561,self.functionspace)
24 arg1.setTaggedValue(1,-0.798066999908)
25 print arg0
26 print arg1
27 res=arg0+arg1
28 print res
29 ref=Data(numarray.array([5.4022518198315126, 4.2614777440630327]),self.functionspace)
30 ref.setTaggedValue(1,numarray.array([3.7916899703627909, 2.650915894594311]))
31 self.failUnless(isinstance(res,Data),"wrong type of result.")
32 self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
33 self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
34 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35 def test_inverse_array_dim1(self):
36 arg=numarray.array([[1.3914367298126584]])
37 res=inverse(arg)
38 self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
39 self.failUnlessEqual(res.shape,(1, 1),"wrong shape of result.")
40 self.failUnless(Lsup(matrixmult(res,arg)-kronecker(1))<=self.RES_TOL,"wrong result")
41
42 if __name__ == '__main__':
43 suite = unittest.TestSuite()
44 suite.addTest(unittest.makeSuite(Test_util2))
45 s=unittest.TextTestRunner(verbosity=2).run(suite)

  ViewVC Help
Powered by ViewVC 1.1.26