1 |
# $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) |