def test_get_slope_pos(self): point_1 = Point(1, 2) point_2 = Point(2, 4) slope = get_slope(point_1, point_2) self.assertEqual(slope, 2) point_1 = Point(1, 2) point_2 = Point(3, 3) slope = get_slope(point_1, point_2) self.assertEqual(slope, 0.5)
def test_get_slope_neg(self): point_1 = Point(1, 2) point_2 = Point(0, 4) slope = get_slope(point_1, point_2) self.assertEqual(slope, -2) point_1 = Point(2, 2) point_2 = Point(0, 3) slope = get_slope(point_1, point_2) self.assertEqual(slope, -0.5)
def test_get_slope_pos_inf(self): point_1 = Point(0, 0) point_2 = Point(0, 2) slope = get_slope(point_1, point_2) self.assertEqual(slope, float('inf'))
def test_get_slope_zero(self): point_1 = Point(2, 1) point_2 = Point(3, 1) slope = get_slope(point_1, point_2) self.assertEqual(slope, 0)
def test_get_slope_neg_inf(self): point_1 = Point(0, 2) point_2 = Point(0, 1) slope = get_slope(point_1, point_2) self.assertEqual(slope, float('-inf'))