Example #1
0
 def test_wrong_input_type(self):
     self.assertRaises(ValueError, lambda: equation_of_a_straight_line("string", 2, "string2", "string3"))
     self.assertRaises(ValueError, lambda: equation_of_a_straight_line(2, 2, 3.5, "string"))
Example #2
0
 def test_y1_equal_y2(self):
     self.assertEqual(equation_of_a_straight_line(-3, -4.5, 300, -4.5), "y=-4.5")
     self.assertEqual(equation_of_a_straight_line(-3, 101.33, 300, 101.33), "y=101.33")
Example #3
0
 def test_same_point(self):
     self.assertEqual(equation_of_a_straight_line(2, -3, 2, -3), "Many equations of a straight line")
     self.assertEqual(equation_of_a_straight_line(0, 0, 0, 0), "Many equations of a straight line")
Example #4
0
 def test_x1_equal_x2(self):
     self.assertEqual(equation_of_a_straight_line(-10.3, 255, -10.3, -567.2), "x=-10.3")
     self.assertEqual(equation_of_a_straight_line(50.2, 255, 50.2, -567.2), "x=50.2")
Example #5
0
 def test_equation_of_a_straight_line(self):
     self.assertEqual(equation_of_a_straight_line(5, 6, 7, 11), "y=2.5x-6.5")
     self.assertEqual(equation_of_a_straight_line(-10, -23, -4, 10), "y=5.5x+32.0")
     self.assertEqual(equation_of_a_straight_line(6.5, -2.3, -2.3, 4.33424), "y=-0.7538909090909091x+2.6002909090909094")