diff --git a/src/main/py/read_math_function.py b/src/main/py/read_math_function.py index 815b256..7507e13 100644 --- a/src/main/py/read_math_function.py +++ b/src/main/py/read_math_function.py @@ -7,7 +7,12 @@ def read_math_function(): print("k - verkettete Funktionen (Demnächst verfügbar)") print("x - Ich möchte nichts mehr einlesen lassen") type = input("Zur Zeit können nur Konstanten eingelesen werden. Bitte geben Sie den Typ ihrer Funktion ein:" ) - if type == "x": + if type != "x": + function = input("Ihre Funktion: ") + simplified = simplify_constant(type, function) + return simplified + + else: return False diff --git a/src/test/py/test_read_math_function.py b/src/test/py/test_read_math_function.py index 0ca4581..5b37c78 100644 --- a/src/test/py/test_read_math_function.py +++ b/src/test/py/test_read_math_function.py @@ -28,6 +28,9 @@ class read_function(unittest.TestCase): def test_read_math_function_false_if_enter_x(self, mock_input): result = read_math_function() self.assertFalse(result) + @patch('builtins.input', side_effect=["c", "5"]) + def test_read_math_function_return5_if_enter_c_5(self, mock_input): + self.assertEqual(read_math_function(), 5) if __name__ == '__main__': unittest.main()