/[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 2840 by jfenwick, Thu Dec 3 01:35:08 2009 UTC revision 2841 by jfenwick, Thu Jan 14 01:02:56 2010 UTC
# Line 199  class Test_Domain(unittest.TestCase): Line 199  class Test_Domain(unittest.TestCase):
199         for i in self.boundary_tag_list:         for i in self.boundary_tag_list:
200             self.failUnless(i in tags, "tag %s is missing."%i)             self.failUnless(i in tags, "tag %s is missing."%i)
201    
202       def test_Factories(self):
203        fs=Function(self.domain)    # The choice of functionspace is arbitrary
204        dime=self.domain.getDim()
205        if dime>0:
206           z=[]
207           bad=[]
208           for i in range(dime):
209            z+=[i]
210            bad+=[i]
211           bad+=[i]
212           d=Vector(z,fs)
213           self.failUnless(d.getShape()==(dime,))
214           self.failUnlessRaises(RuntimeError, Vector, bad,fs)  #test wrong shape
215           y=[]
216           bad=[]
217           for i in range(dime):
218            y+=[z]
219            bad+=[z]
220           bad+=[z]
221           z=y
222           d=Tensor(z,fs)
223           self.failUnless(d.getShape()==(dime,dime))
224           try:
225            Tensor(bad,fs)
226           except RuntimeError:
227            pass
228           else:
229            self.fail("Tensor should have rejected bad shape")
230           y=[]
231           bad=[]
232           for i in range(dime):
233            y+=[z]
234            bad+=[z]
235           bad+=[z]
236           z=y
237           d=Tensor3(z,fs)
238           self.failUnless(d.getShape()==(dime,dime,dime))
239           try:
240            Tensor3(bad,fs)
241           except RuntimeError:
242            pass
243           else:
244            self.fail("Tensor3 should have rejected bad shape")
245           y=[]
246           bad=[]
247           for i in range(dime):
248            y+=[z]
249            bad+=[z]
250           bad+=[z]
251           z=y
252           d=Tensor4(z,fs)
253           self.failUnless(d.getShape()==(dime,dime,dime,dime))
254           try:
255            Tensor4(bad,fs)
256           except RuntimeError:
257            pass
258           else:
259            self.fail("Tensor4 should have rejected bad shape")
260    
261    
262     def test_addTags(self):     def test_addTags(self):
263          tag1="A"          tag1="A"
264          tag2="B"          tag2="B"

Legend:
Removed from v.2840  
changed lines
  Added in v.2841

  ViewVC Help
Powered by ViewVC 1.1.26