def test_slope_negative(self): s1 = IntegerSegment(IntegerPoint(0, 0), IntegerPoint(2, -1)) self.assertEqual(s1.slope(), -0.5)
def test_slope_zero(self): s1 = IntegerSegment(IntegerPoint(0, 0), IntegerPoint(1, 0)) self.assertEqual(s1.slope(), 0)
def test_slope_positive(self): s1 = IntegerSegment(IntegerPoint(0, 0), IntegerPoint(2, 1)) self.assertEqual(s1.slope(), 0.5)
def test_slope_inf(self): s1 = IntegerSegment(IntegerPoint(0, 0), IntegerPoint(0, 1)) self.assertEqual(s1.slope(), float("inf"))