def test_should_return_None_when_no_input_from_stdin(self, mock_select, mock_stdin): actual = commandstub.read_stdin() self.assertEqual('', actual)
def test_should_return_input_from_stdin(self, mock_select, mock_stdin): mock_select.return_value = ([StringIO('Hello world')], [], []) actual = commandstub.read_stdin() self.assertEqual('Hello world', actual)
def test_should_use_a_one_second_timeout_when_waiting_for_stdin(self, mock_select, mock_stdin): commandstub.read_stdin() self.assertEqual(call([sys.stdin], [], [], 1), mock_select.call_args)