def test_del_brackets(self): arr1 = ['(', 1.0, '*', 4.0, ')', '-', '(', 13.0, '^', 3.0, '^', 3.0, ')'] arr2 = ['(', '(', 1.0, '*', 4.0, ')', '+', 15.0, ')'] arr3 = [3.0, '-', 14.4, '+', '(', 0, '-', 13.9, '*', '(', 1.0, '-', 1.0, '*', 5.9, ')', ')' ] arr4 = ['(', -14.5, '(', '(', 14.0, '+', 0.1, ')', '-', 0, ')', ')'] self.assertEqual(brackets(arr1), [1.0, '*', 4.0]) self.assertEqual(brackets(arr2), [1.0, '*', 4.0]) self.assertEqual(brackets(arr3), [1.0, '-', 1.0, '*', 5.9]) self.assertEqual(brackets(arr4), [14.0, '+', 0.1])
def test_del_calc(): inp = ['(', 258.0, '+', '(', 25.0, '*', 3.0, ')', ')'] res = 75 assert calculating_w_out_br(brackets(inp))
def test_test_br(): arr = ['(', 15.0, '-', '(', 5.0, '+', 4.0, ')', ')'] out = [5.0, '+', 4.0] assert brackets(arr) == out
def test_del_calc2(): inp = ['(', 999999.0, '^', 999999.0, '+', 1.0, ')'] res = 'Result too large' assert calculating_w_out_br(brackets(inp))
def test_del_calc1(): inp = ['(', 258.0, '+', 11, ')'] res = 269 assert calculating_w_out_br(brackets(inp))