From fb17b15e1ddc68990e2b69a6c8e989ca261360d1 Mon Sep 17 00:00:00 2001 From: fdai7763 Date: Wed, 24 Jan 2024 00:21:15 +0100 Subject: [PATCH] refactoring: added new lines --- src/test/py/test_read_math_function.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/py/test_read_math_function.py b/src/test/py/test_read_math_function.py index 7597ff7..f68f19a 100644 --- a/src/test/py/test_read_math_function.py +++ b/src/test/py/test_read_math_function.py @@ -5,25 +5,35 @@ from unittest.mock import patch class read_function(unittest.TestCase): def test_constant_without_calculation(self): self.assertEqual(simplify_constant("c", 42), 42) + def test_constant_no_c(self): self.assertEqual(simplify_constant("e", "42*e^x"), False) + def test_constant_isstring_true(self): self.assertEqual(is_string("42*e^x"), True) + def test_constant_isstring_false(self): self.assertEqual(is_string(42), False) + def test_constant_isallowed_string_true(self): self.assertEqual(is_allowed_string("c", "42^(2)+1-3*4/3"), True) + def test_constant_isallowed_string_false(self): self.assertEqual(is_allowed_string("c", "42^(2)+1-3*4/3x"), False) + def test_constant_calculate_without_pow(self): self.assertEqual(calculate_constant_string("42+1-3*4/3"), 39) + def test_constant_calculate_with_pow(self): self.assertEqual(calculate_constant_string("42^(2)+1-3*4/3"), 1761) + def test_constant_calculate_string_decision(self): self.assertEqual(simplify_constant("c", "42^(2)+1-3*4/3"), 1761) + def test_constant_string_not_allowed_decision(self): self.assertEqual(simplify_constant("c", "42^(2)+1-3*4/3x"), False) + @patch('builtins.input', side_effect=["x"]) def test_read_math_function_false_if_enter_x(self, mock_input): result = read_math_function()