예제 #1
0
    def test_exit_case(self, mock_inputs):
        mock_inputs.side_effect = [""]

        expected_result = (
            "Sorry, you must provide at least one number."
        )

        with captured_output() as (outputs, errors):
            compare_numbers.main()
            test_val = outputs.getvalue().strip()

        self.assertEqual(expected_result, test_val)
예제 #2
0
    def test_8_is_max(self, mock_inputs):
        # Note, need to include the exit case "" in order to exit input loop
        mock_inputs.side_effect = ["3", "-100", "5.432", "8", ""]

        expected_result = (
            "The largest number is 8.0."
        )

        with captured_output() as (outputs, errors):
            compare_numbers.main()
            test_val = outputs.getvalue().strip()

        self.assertEqual(expected_result, test_val)
예제 #3
0
from compare_numbers import compare_numbers

compare_numbers.main()