Ejemplo n.º 1
0
 def test_str(self):
     '''
     Test calling str operator to perform code
     '''
     n = Node(point2D=(0,0), name='TestNode')
     other = Node(point2D=(1,3), name='OtherTestNode')
     n.addLink(other)
     _ = str(n)
Ejemplo n.º 2
0
 def test_distance(self):
     '''
     Test to checking euclidean distance over 2DPoints
     '''
     origin_points = [(1,1), (1,2),   (0,0),   (0,0), (0,0), (10,10)]
     end_points =    [(1,1), (1,3), (-1,-1), (10,10), (3,4), (3,4)  ]
     distance =      [0    , 1    , 1.4142 , 14.1421, 5    , 9.2195 ]
     for i in xrange(len(origin_points)):
         origin = Node(origin_points[i])
         end = Node(end_points[i])
         self.assertAlmostEqual(origin.distance(end), distance[i], places=4)