def test_calculator_arithmetic(expression, answer): calc = RPCalc() for element in expression: calc.push(element) assert calc.peek() == answer, \ f"expected an answer of {answer}"
def test_peek_implemented(): assert hasattr(RPCalc(), 'peek'), \ "peek not implemented"
def test_peek(): calc = RPCalc() calc.push(1) calc.peek() assert bool(calc), \ "expected non-empty stack"
def test_length(): calc = RPCalc() calc.push(1) calc.push(2) calc.push("+") assert len(calc) == 1
def test_pop(): calc = RPCalc() calc.push(1) calc.pop() assert not bool(calc), \ "expected empty stack"
def test_pop_implemented(): assert hasattr(RPCalc(), 'pop'), \ "pop not implemented"
def test_length_implemented(): assert hasattr(RPCalc(), '__len__'), \ "RPCalc has no len special method"
def test_push(elements): calc = RPCalc() for element in elements: calc.push(element)
def test_push_implemented(): assert hasattr(RPCalc(), 'push'), \ "push not implemented"
def test_peek_implemented(): assert hasattr(RPCalc(), "peek"), "peek not implemented"
def test_pop_implemented(): assert hasattr(RPCalc(), "pop"), "pop not implemented"
def test_push_implemented(): assert hasattr(RPCalc(), "push"), "push not implemented"