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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 589 - (hide annotations)
Fri Mar 10 06:28:35 2006 UTC (14 years, 11 months ago) by gross
File MIME type: text/x-python
File size: 1302 byte(s)
my little test generator
1 gross 399 # $Id:$
2     """
3     frame to ran a single test out of the Test_util suite
4     """
5    
6     import unittest
7     from esys.escript import *
8     from esys.finley import Rectangle
9     import numarray
10    
11     class Test_util2(unittest.TestCase):
12     RES_TOL=1.e-7
13     def setUp(self):
14     self.__dom =Rectangle(10,10,2)
15     self.functionspace = FunctionOnBoundary(self.__dom) # due to a bug in escript python needs to hold a reference to the domain
16 gross 589 def test_add_overloaded_constData_rank1_taggedData_rank0(self):
17     arg0=Data(numarray.array([4.5897569702707663, 3.4489828945022865]),self.functionspace)
18     arg1=Data(0.812494849561,self.functionspace)
19     arg1.setTaggedValue(1,-0.798066999908)
20     print arg0
21     print arg1
22     res=arg0+arg1
23     print res
24     ref=Data(numarray.array([5.4022518198315126, 4.2614777440630327]),self.functionspace)
25     ref.setTaggedValue(1,numarray.array([3.7916899703627909, 2.650915894594311]))
26     self.failUnless(isinstance(res,Data),"wrong type of result.")
27     self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
28     self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
29 gross 399 if __name__ == '__main__':
30     suite = unittest.TestSuite()
31     suite.addTest(unittest.makeSuite(Test_util2))
32     s=unittest.TextTestRunner(verbosity=2).run(suite)

  ViewVC Help
Powered by ViewVC 1.1.26