Ignore:
Timestamp:
Feb 25, 2009, 9:37:22 AM (15 years ago)
Author:
rwilson
Message:

numpy changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/abstract_2d_finite_volumes/test_general_mesh.py

    r6304 r6410  
    6363        domain = General_mesh(nodes, triangles,
    6464                       geo_reference = geo)
     65
    6566        verts = domain.get_vertex_coordinates(triangle_id=0)       
    66         self.assert_(num.allclose(num.array([b,a,c]), verts))
     67        msg = ("num.array([b,a,c])=\n%s\nshould be the same as 'verts'=\n%s"
     68               % (str(num.array([b,a,c])), str(verts)))
     69        #self.assert_(num.allclose(num.array([b,a,c]), verts))
     70        assert num.allclose(num.array([b,a,c]), verts), msg
     71
    6772        verts = domain.get_vertex_coordinates(triangle_id=0)       
    6873        self.assert_(num.allclose(num.array([b,a,c]), verts))
     
    117122        domain = General_mesh(nodes, triangles)
    118123
    119         value = [7]
    120         assert num.allclose(domain.get_triangles(), triangles)
     124#        value = [7]
     125        msg = ("domain.get_triangles()=\n%s\nshould be the same as "
     126               "'triangles'=\n%s"
     127               % (str(domain.get_triangles()), str(triangles)))
     128        assert num.allclose(domain.get_triangles(), triangles), msg
     129        msg = ("domain.get_triangles([0,4])=\n%s\nshould be the same as "
     130               "'[triangles[0], triangles[4]]' which is\n%s"
     131               % (str(domain.get_triangles([0,4])),
     132                  str([triangles[0], triangles[4]])))
    121133        assert num.allclose(domain.get_triangles([0,4]),
    122                         [triangles[0], triangles[4]])
     134                            [triangles[0], triangles[4]]), msg
    123135       
    124136
     
    278290        node = domain.get_node(2)       
    279291        #self.assertEqual(c, node)
    280         self.failUnless(num.alltrue(c == node))
     292        msg = ('\nc=%s\nmode=%s' % (str(c), str(node)))
     293        self.failUnless(num.alltrue(c == node), msg)
    281294       
    282295        node = domain.get_node(2, absolute=True)     
     
    328341
    329342#-------------------------------------------------------------
     343
    330344if __name__ == "__main__":
    331345    suite = unittest.makeSuite(Test_General_Mesh,'test')
    332     #suite = unittest.makeSuite(Test_General_Mesh,'test_get_node')   
    333346    runner = unittest.TextTestRunner()
    334347    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.