def testMethodGenerateRectangle(self):
        """
        Generates a rectangle with four point values
        """
        generator = RectanglePairJSONGenerator()
        rectangle = generator.generateRectangle(2)
        self.assertEqual(type(rectangle), tuple)
        self.assertEqual(len(rectangle), 4)
        p1 = Point(rectangle[0][0], rectangle[0][1])
        p2 = Point(rectangle[1][0], rectangle[1][1])
        p3 = Point(rectangle[2][0], rectangle[2][1])
        p4 = Point(rectangle[3][0], rectangle[3][1])

        self.assertTrue(isRectangle(p1, p2, p3, p4))
Exemplo n.º 2
0
 def _queueify(self, data, point):
     q = []
     for _, row in data.iterrows():
         row_coords = np.array(row[:-1])
         q.append(Point(row['cls'], self.get_dist(row_coords, point)))
     heapq.heapify(q)
     return q
Exemplo n.º 3
0
 def testInstantiation(self):
     """
     Initialize the point with two values
     """
     point = Point()
     self.assertIsInstance(point, Point)
     self.assertEqual(point.x, 0)
     self.assertEqual(point.y, 0)
Exemplo n.º 4
0
 def testWithFloatValues(self):
     """
     Initialize the point with two float values
     """
     point = Point(-1.5, 3.3)
     self.assertIsInstance(point, Point)
     self.assertEqual(point.x, -1.5)
     self.assertEqual(point.y, 3.3)    
Exemplo n.º 5
0
 def testWithNegativeValues(self):
     """
     Initialize the point with two negative values
     """
     point = Point(-1, -3)
     self.assertIsInstance(point, Point)
     self.assertEqual(point.x, -1)
     self.assertEqual(point.y, -3)
Exemplo n.º 6
0
 def testMethodGetCoordinatesWithFloats(self):
     """
     Returns the coordinates of the point as a tuple with float inputs
     """
     point = Point(-1.5,1).getCoordinates()
     self.assertEqual(point, (-1.5,1))             
Exemplo n.º 7
0
 def testMethodGetCoordinatesWithNegatives(self):
     """
     Returns the coordinates of the point as a tuple with negative inputs
     """
     point = Point(-1,-1).getCoordinates()
     self.assertEqual(point, (-1,-1))             
Exemplo n.º 8
0
 def testMethodGetCoordinatesWithDefaults(self):
     """
     Returns the default coordinates of the point as a tuple
     """
     point = Point().getCoordinates()
     self.assertEqual(point, (0,0))
Exemplo n.º 9
0
 def testMethodGetCoordinates(self):
     """
     Returns the coordinates of the point as a tuple
     """
     point = Point(1,1).getCoordinates()
     self.assertEqual(point, (1,1))