def test_onlyLogFailedAddresses(self):
        """
        L{smtp.SenderMixin.sentMail} adds only the addresses with failing
        SMTP response codes to the log passed to the factory's errback.
        """
        onDone = self.assertFailure(defer.Deferred(), smtp.SMTPDeliveryError)
        onDone.addCallback(lambda e: self.assertEqual(
                e.log, b"bob@example.com: 199 Error in sending.\n"))

        clientFactory = smtp.SMTPSenderFactory(
            'source@address', 'recipient@address',
            BytesIO(b"Message body"), onDone,
            retries=0, timeout=0.5)

        client = clientFactory.buildProtocol(
            address.IPv4Address('TCP', 'example.net', 25))

        addresses = [(b"alice@example.com", 200, b"No errors here!"),
                     (b"bob@example.com", 199, b"Error in sending.")]
        client.sentMail(199, b"Test response", 1, addresses, client.log)

        return onDone

        L{smtp.SenderMixin.sentMail} adds only the addresses with failing
        SMTP response codes to the log passed to the factory's errback.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/test/test_smtp.py