Ejemplo n.º 1
0
 def test_reset_values(self):
     """reset            -- points equal input values after reset"""
     nc = Ncoords(self.random_points, tolist=1)
     nc.reset()  ### tested call ###
     result = nc.getResultCoords()
     # compare input and output point lists
     self.assertEqual(self.random_points, result)
Ejemplo n.º 2
0
 def test_reset_values(self):
     """reset            -- points equal input values after reset"""
     nc = Ncoords( self.random_points, tolist=1)
     nc.reset() ### tested call ###
     result = nc.getResultCoords()
     # compare input and output point lists
     self.assertEqual( self.random_points, result)
Ejemplo n.º 3
0
 def test_getResultCoords_type(self):
     """getResultCoords  -- if not tolist: return nx4 Numeric.array"""
     n = len(self.random_points)
     nc = Ncoords(self.random_points, tolist=1)
     nc.tolist = 0
     result = nc.getResultCoords()  ### tested call ###
     # confirm shape
     self.assertEqual((n, 4), Numeric.shape(result))
     # confirm type
     self.assertEqual(type(Numeric.array([])), type(result))
Ejemplo n.º 4
0
 def test_getResultCoords_shape(self):
     """getResultCoords  -- if tolist: return nx3 ListType"""
     n = len(self.random_points)
     nc = Ncoords(self.random_points, tolist=0)
     nc.tolist = 1
     result = nc.getResultCoords()  ### tested call ###
     # confirm shape
     self.assertEqual((n, 3), Numeric.shape(result))
     # confirm type
     self.assertEqual(type([]), type(result))
Ejemplo n.º 5
0
 def test_getResultCoords_type(self):
     """getResultCoords  -- if not tolist: return nx4 Numeric.array"""
     n = len(self.random_points)
     nc = Ncoords(self.random_points, tolist=1)
     nc.tolist=0
     result = nc.getResultCoords() ### tested call ###
     # confirm shape
     self.assertEqual((n, 4), Numeric.shape(result))
     # confirm type
     self.assertEqual(type(Numeric.array([])), type(result))
Ejemplo n.º 6
0
 def test_getResultCoords_shape(self):
     """getResultCoords  -- if tolist: return nx3 ListType"""
     n = len(self.random_points)
     nc = Ncoords(self.random_points, tolist=0)
     nc.tolist=1
     result = nc.getResultCoords() ### tested call ###
     # confirm shape
     self.assertEqual((n, 3), Numeric.shape(result))
     # confirm type
     self.assertEqual(type([]), type(result))
Ejemplo n.º 7
0
 def test_constructor_shape(self):
     """__init__         -- make refCoords and resultCoords homogeneous"""
     n = len(self.random_points)
     ncoords = Ncoords(self.random_points)  ### tested call ###
     # confirm shape to be nx4
     self.assertEqual((n, 4), Numeric.shape(ncoords.resultCoords))
     self.assertEqual((n, 4), Numeric.shape(ncoords.refCoords))
     # cofirm that the last column is all ones
     self.assertEqual(
         Numeric.ones(n).tolist(), ncoords.resultCoords[:, 3].tolist())
     self.assertEqual(
         Numeric.ones(n).tolist(), ncoords.refCoords[:, 3].tolist())