Browse Source

added test for simplify_easy_math_function returns False when type isn't "v" as well as corresponding functionality

remotes/origin/feature/feature-read-math-functions
fdai7763 11 months ago
parent
commit
3e1ca5ce66
  1. 4
      src/main/py/read_math_function.py
  2. 3
      src/test/py/test_read_math_function.py

4
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

3
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()
Loading…
Cancel
Save