Esempio n. 1
0
 def test_slope_horizontal(self):
     """
     Tests computing slope of a horizontal line
     """
     start = Point(-79.2, 40)
     end = Point(-86.2, 40)
     border = Border(start, end)
     self.assertEqual(0, border._get_slope(), "Horizontal slope calculation not working")
Esempio n. 2
0
 def test_slope_vertical(self):
     """
     Tests computing slope of a vertical line
     """
     start = Point(-79.2, 40)
     end = Point(-79.2, 33)
     border = Border(start, end)
     self.assertTrue(math.isinf(border._get_slope()), "Vertical slope calculation not working")
Esempio n. 3
0
 def test_slope_regular(self):
     """
     Tests computing slope of a non vertical and non horizontal line
     """
     start = Point(-79.2, 40)
     end = Point(-86.2, 33)
     border = Border(start, end)
     self.assertEqual(1.0, border._get_slope(), "Regular slope calculation not working")