示例#1
0
 def test_returns_none_for_complex_solution(self):
     root1, root2 = get_roots(1, 2, 3)
     self.assertIsNone(root1)
     self.assertIsNone(root2)
示例#2
0
 def test_solves_real_roots(self):
     root1, root2 = get_roots(1, -2, 1)
     self.assertEqual(root1, 1)
示例#3
0
 def test_first_root_less_than_second(self):
     root1, root2 = get_roots(1, 2, -3)
     self.assertEqual(root1, -3)
     self.assertEqual(root2, 1)
示例#4
0
 def test_second_root_is_none_if_one_solution(self):
     root1, root2 = get_roots(1, -2, 1)
     self.assertIsNotNone(root1)
     self.assertIsNone(root2)
示例#5
0
def run():

    quadratic_equation.input_data()
    quadratic_equation.discriminant()
    quadratic_equation.get_roots()
示例#6
0
 def test_solves_real_roots(self):
     root1, root2 = get_roots(1, -2, 1)
     self.assertEqual(root1, 1)
示例#7
0
 def test_returns_none_for_complex_solution(self):
     root1, root2 = get_roots(1, 2, 3)
     self.assertIsNone(root1)
     self.assertIsNone(root2)
示例#8
0
 def test_second_root_is_none_if_one_solution(self):
     root1, root2 = get_roots(1, -2, 1)
     self.assertIsNotNone(root1)
     self.assertIsNone(root2)
示例#9
0
 def test_first_root_less_than_second(self):
     root1, root2 = get_roots(1, 2, -3)
     self.assertEqual(root1, -3)
     self.assertEqual(root2, 1)