def test_write_multiline(self): mock_logger = mock.Mock() _StreamLogger(mock_logger, self.TEST_LOG_LEVEL).write('testing\n1\n2\n3\n\n') mock_logger.log.assert_has_calls([ mock.call(self.TEST_LOG_LEVEL, 'testing'), mock.call(self.TEST_LOG_LEVEL, '1'), mock.call(self.TEST_LOG_LEVEL, '2'), mock.call(self.TEST_LOG_LEVEL, '3') ])
def test_write_multiline(self): mock_logger = mock.Mock() _StreamLogger(mock_logger, self.TEST_LOG_LEVEL).write("testing\n1\n2\n3\n\n") mock_logger.log.assert_has_calls( [ mock.call(self.TEST_LOG_LEVEL, "testing"), mock.call(self.TEST_LOG_LEVEL, "1"), mock.call(self.TEST_LOG_LEVEL, "2"), mock.call(self.TEST_LOG_LEVEL, "3"), ] )
def test_flush(self): _StreamLogger(mock.Mock(), self.TEST_LOG_LEVEL).flush()
def test_write(self): mock_logger = mock.Mock() _StreamLogger(mock_logger, self.TEST_LOG_LEVEL).write('testing 1 2 3') mock_logger.log.assert_called_once_with(self.TEST_LOG_LEVEL, 'testing 1 2 3')