From 3e1ca5ce66980c4847c635b5874fdc8b5b273023 Mon Sep 17 00:00:00 2001 From: fdai7763 Date: Tue, 23 Jan 2024 22:21:22 +0100 Subject: [PATCH] added test for simplify_easy_math_function returns False when type isn't "v" as well as corresponding functionality --- src/main/py/read_math_function.py | 4 ++++ src/test/py/test_read_math_function.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/main/py/read_math_function.py b/src/main/py/read_math_function.py index e540758..83f8469 100644 --- a/src/main/py/read_math_function.py +++ b/src/main/py/read_math_function.py @@ -45,3 +45,7 @@ def calculate_constant_string(string): return eval(string) except Exception as e: return f"Fehler bei der Berechnung: {str(e)}" + +def simplify_easy_math_function(type, function): + if type != "v": + return False \ No newline at end of file diff --git a/src/test/py/test_read_math_function.py b/src/test/py/test_read_math_function.py index 5b37c78..978abdc 100644 --- a/src/test/py/test_read_math_function.py +++ b/src/test/py/test_read_math_function.py @@ -32,5 +32,8 @@ class read_function(unittest.TestCase): def test_read_math_function_return5_if_enter_c_5(self, mock_input): self.assertEqual(read_math_function(), 5) + def test_easy_function_wrong_type(self): + self.assertEqual(simplify_easy_math_function("a", "42x"), False) + if __name__ == '__main__': unittest.main()