/[escript]/trunk/escript/test/python/test_objects.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_objects.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1043 by gross, Wed Mar 14 23:49:20 2007 UTC revision 1044 by gross, Mon Mar 19 07:29:31 2007 UTC
# Line 41  import os Line 41  import os
41  import numarray  import numarray
42  from esys.escript import *  from esys.escript import *
43    
44    class Test_Domain(unittest.TestCase):
45       def test_addTags(self):
46            tag1="A"
47            tag2="B"
48            tag3="C"
49            self.domain.setTagMap(tag1,1)
50            self.failUnless(self.domain.isValidTagName(tag1))
51            self.failUnless(not self.domain.isValidTagName(tag2))
52            self.domain.setTagMap(tag2,2)
53            self.failUnless(self.domain.isValidTagName(tag1))
54            self.failUnless(self.domain.isValidTagName(tag2))
55            self.failUnless(not self.domain.isValidTagName(tag3))
56            self.failUnless(self.domain.getTag(tag1)==1)
57            self.failUnless(self.domain.getTag(tag2)==2)
58            self.failUnlessRaises(RuntimeError,self.domain.getTag,tag3)
59    
60            # set tag:
61            s=Scalar(0,Function(self.domain))
62            r=Scalar(0,Function(self.domain))
63            s.setTaggedValue(tag1,1.)
64            r.setTaggedValue(1,1.)
65            s.setTaggedValue(tag2,2.)
66            r.setTaggedValue(2,2.)
67            s.setTaggedValue(tag3,3.)
68            self.failUnless(Lsup(s-r)<=0.)
69            # get tag:
70            names=getTagNames(self.domain)
71            self.failUnless(len(names) == 2)
72            self.failUnless( tag1 in names )
73            self.failUnless( tag2 in names )
74            self.failUnless(self.domain.isValidTagName(tag1))
75            self.failUnless(self.domain.isValidTagName(tag2))
76            # insert tag shortcut:
77            s2=insertTaggedValues(Scalar(0,Function(self.domain)),**{ tag1 : 1., tag2 : 2.})
78            self.failUnless(Lsup(s2-r)<=0.)
79            
80    
81    
82  class Test_Dump(unittest.TestCase):  class Test_Dump(unittest.TestCase):
83     arg0=9.81     arg0=9.81
84     arg1=numarray.array([3.098, -3.111])     arg1=numarray.array([3.098, -3.111])

Legend:
Removed from v.1043  
changed lines
  Added in v.1044

  ViewVC Help
Powered by ViewVC 1.1.26