From 660529193b318b73463c7d8ec73dec47c46772e1 Mon Sep 17 00:00:00 2001 From: fdai7763 Date: Tue, 23 Jan 2024 20:11:28 +0100 Subject: [PATCH] added test for returning "False" if type isn't constant 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 b42196d..3b6238b 100644 --- a/src/main/py/read_math_function.py +++ b/src/main/py/read_math_function.py @@ -1,2 +1,4 @@ def read_constant(type, value): + if type != "c": + value = False return value \ 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 b17343d..3ee918b 100644 --- a/src/test/py/test_read_math_function.py +++ b/src/test/py/test_read_math_function.py @@ -5,6 +5,8 @@ from src.main.py.read_math_function import * class read_function(unittest.TestCase): def test_constant_without_calculation(self): self.assertEqual(read_constant("c", 42), 42) + def test_constant_no_c(self): + self.assertEqual(read_constant("e", "42*e^x"), False) if __name__ == '__main__': unittest.main()