def index(): tree = request.get_json(force=True) result = math_eval(tree) return str(result) + '\n'
def test_identity(): assert math_eval(5) == 5, 'identity'
def test_single_element(): assert math_eval(['+', 5]) == 5, 'single element'
def test_nested(): assert math_eval(['*', ['+', 5, 4], 2]) == 18
def test_addition(): assert math_eval(['+', 5, 7]) == 12, 'adding two numbers'
def _check(self, tree, expected): self.assertEqual(math_eval(tree), expected)
def index(): tree = request.get_json(force=True) result = math_eval(tree); return str(result) + "\n"