def test_get_selection_interrupt(self, mock_input, mock_sys,
                                     mock_print_tty):  # noqa
        mock_input.side_effect = [KeyboardInterrupt, 2]
        options = ["one"]

        mock_sys.exit.side_effect = SystemExit
        with self.assertRaises(SystemExit):
            prompt.get_selection(options=options)

        mock_print_tty.assert_any_call("Selection: ", newline=False)
    def test_get_selection(self, mock_input, mock_print_tty):
        mock_input.return_value = 1
        options = ["one", "two"]
        item_value = prompt.get_selection(options=options)

        self.assertEqual(item_value, "one")
        mock_print_tty.assert_any_call("Selection: ", newline=False)
    def test_get_selection_no_input(self, mock_input, mock_print_tty):
        mock_input.side_effect = [SyntaxError, 2]
        options = ["one", "two"]
        item_value = prompt.get_selection(options=options)

        self.assertEqual(item_value, "two")
        mock_print_tty.assert_any_call(
            "WARNING: Please supply a value from 1 to 2!")