diff --git a/src/main/py/read_math_function.py b/src/main/py/read_math_function.py index 0b2cdd9..00a9327 100644 --- a/src/main/py/read_math_function.py +++ b/src/main/py/read_math_function.py @@ -4,6 +4,8 @@ def read_constant(type, value): if is_string(value): if is_allowed_string(type, value): return calculate_string(value) + else: + return False return value diff --git a/src/test/py/test_read_math_function.py b/src/test/py/test_read_math_function.py index b8fb7d1..0fe03d2 100644 --- a/src/test/py/test_read_math_function.py +++ b/src/test/py/test_read_math_function.py @@ -21,6 +21,8 @@ class read_function(unittest.TestCase): self.assertEqual(calculate_string("42^(2)+1-3*4/3"), 1761) def test_constant_calculate_string_decision(self): self.assertEqual(read_constant("c", "42^(2)+1-3*4/3"), 1761) + def test_constant_string_not_allowed_decision(self): + self.assertEqual(read_constant("c", "42^(2)+1-3*4/3x"), False) if __name__ == '__main__': unittest.main()