def main(): # Display Help in the beginning of the program. print RPN.rpn_help() # Get into a controlled Daemon/infinite loop. while True: # Get the RPN expression input_text = RPN.get_input() # Check what have you got, if its an expression, call for evaluation if RPN.is_expression(input_text): output = RPN.evaluate_expression(input_text) print output
def test_get_input_quit(): rpn.raw_input = lambda _: 'quit' text_input = RPN.get_input() assert text_input == 'quit'
def test_get_input_help(): rpn.raw_input = lambda _: 'help' text_input = RPN.get_input() assert text_input == 'help'