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