Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
def test_del_calc():
    inp = ['(', 258.0, '+', '(', 25.0, '*', 3.0, ')', ')']
    res = 75
    assert calculating_w_out_br(brackets(inp))
Exemplo n.º 3
0
def test_calculating3():
    t_arr = [0, '/', 0]
    result = 'zero division'
    assert calculating_w_out_br(t_arr) == result
Exemplo n.º 4
0
def test_calculating2():
    t_arr = [0, '-', 0, '^', 0]
    result = -1
    assert calculating_w_out_br(t_arr) == result
Exemplo n.º 5
0
def test_calculating1():
    t_arr = [0, '-', 0]
    result = 0
    assert calculating_w_out_br(t_arr) == result
Exemplo n.º 6
0
def test_calculating():
    t_arr = [3.0, '+', 4.0]
    result = 7
    assert calculating_w_out_br(t_arr) == result
Exemplo n.º 7
0
def test_del_calc2():
    inp = ['(', 999999.0, '^', 999999.0, '+', 1.0, ')']
    res = 'Result too large'
    assert calculating_w_out_br(brackets(inp))
Exemplo n.º 8
0
def test_del_calc1():
    inp = ['(', 258.0, '+', 11, ')']
    res = 269
    assert calculating_w_out_br(brackets(inp))