/[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 399 - (hide annotations)
Wed Dec 21 22:43:48 2005 UTC (14 years, 9 months ago) by gross
File MIME type: text/x-python
File size: 1007 byte(s)
frame to run a single test out of the test_util suite
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    
17     def test_wherePositive_array_rank0(self):
18     arg=numarray.array(-15.0739210922)
19     res=wherePositive(arg)
20     ref=numarray.array(0.0)
21     print res
22     if isinstance(res,numarray.NumArray):
23     self.failUnlessEqual(res.shape,(),"wrong shape of result.")
24     else:
25     self.failUnless(isinstance(res,float),"wrong type of result.")
26     self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
27    
28    
29     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