def test_print(self):
        """
        When StdioOnnaStick is set as sys.stdout, prints become log messages.
        """
        oldStdout = sys.stdout
        sys.stdout = log.StdioOnnaStick()
        self.addCleanup(setattr, sys, "stdout", oldStdout)
        print("This", end=" ")
        print("is a test")
        self.assertEqual(self.getLogMessages(), ["This is a test"])

        When StdioOnnaStick is set as sys.stdout, prints become log messages.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_log.py