def test_calc(self): arr1 = [1.0] arr2 = [1.0, '+', 4.0] arr3 = [13.0, '^', 3.0, '^', 3.0] arr4 = [15.543, '/', 15.0, '*', 1.0] arr5 = [15.0, '-', 7.0, '*', 2.0] self.assertEqual(calculating_w_out_br(arr1), 1) self.assertEqual(calculating_w_out_br(arr2), 5) self.assertEqual(calculating_w_out_br(arr3), 10604499373) self.assertEqual(calculating_w_out_br(arr4), 1.0362) self.assertEqual(calculating_w_out_br(arr5), 1)
def test_del_calc(): inp = ['(', 258.0, '+', '(', 25.0, '*', 3.0, ')', ')'] res = 75 assert calculating_w_out_br(brackets(inp))
def test_calculating3(): t_arr = [0, '/', 0] result = 'zero division' assert calculating_w_out_br(t_arr) == result
def test_calculating2(): t_arr = [0, '-', 0, '^', 0] result = -1 assert calculating_w_out_br(t_arr) == result
def test_calculating1(): t_arr = [0, '-', 0] result = 0 assert calculating_w_out_br(t_arr) == result
def test_calculating(): t_arr = [3.0, '+', 4.0] result = 7 assert calculating_w_out_br(t_arr) == result
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))