From 63e01cdd1fb707183015bb75936eaa9db527f31e Mon Sep 17 00:00:00 2001 From: fdai7763 Date: Tue, 23 Jan 2024 22:28:39 +0100 Subject: [PATCH] added test for returning the number if the function is no string as well as corresponding functionality --- src/main/py/read_math_function.py | 2 ++ src/test/py/test_read_math_function.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/py/read_math_function.py b/src/main/py/read_math_function.py index fd6d011..5e08a78 100644 --- a/src/main/py/read_math_function.py +++ b/src/main/py/read_math_function.py @@ -49,3 +49,5 @@ def calculate_constant_string(string): def simplify_easy_math_function(type, function): if type != "v": return False + if is_string(function) == False: + return function diff --git a/src/test/py/test_read_math_function.py b/src/test/py/test_read_math_function.py index 978abdc..4d08b4f 100644 --- a/src/test/py/test_read_math_function.py +++ b/src/test/py/test_read_math_function.py @@ -34,6 +34,8 @@ class read_function(unittest.TestCase): def test_easy_function_wrong_type(self): self.assertEqual(simplify_easy_math_function("a", "42x"), False) + def test_easy_function_number_as_function_return(self): + self.assertEqual(simplify_easy_math_function("v", 42), 42) if __name__ == '__main__': unittest.main()