def test_singleUnicode(self):
        """
        L{log.LogPublisher.msg} does not accept non-ASCII Unicode on Python 2,
        logging an error instead.

        On Python 3, where Unicode is default message type, the message is
        logged normally.
        """
        message = u"Hello, \N{VULGAR FRACTION ONE HALF} world."
        self.lp.msg(message)
        self.assertEqual(len(self.out), 1)
        if _PY3:
            self.assertIn(message, self.out[0])
        else:
            self.assertIn('with str error', self.out[0])
            self.assertIn('UnicodeEncodeError', self.out[0])

        L{log.LogPublisher.msg} does not accept non-ASCII Unicode on Python 2,
        logging an error instead.

        On Python 3, where Unicode is default message type, the message is
        logged normally.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_log.py