"""Test suite for Mann."""
# -*- coding: utf-8 -*-
import unittest
from colour_runner import runner as crunner
# from mypleasure.mann import Mann


class ConsoleTestCase(unittest.TestCase):
    """Test console logger."""

    def runTest(self): # noqa
        pass


def suite():
    """Compose and return test suite."""
    suite = unittest.TestSuite()
    suite.addTest(ConsoleTestCase())
    return suite

if __name__ == '__main__':
    runner = crunner.ColourTextTestRunner()
    runner.run(suite())

"""Test suite for Mann."""
# -*- coding: utf-8 -*-
import sys
import unittest
from io import StringIO
from colour_runner import runner as crunner
from mypleasure.mann import Mann


class ConsoleTestCase(unittest.TestCase):
    """Test console logger."""

    def runTest(self): # noqa
        try:
            out = StringIO()
            sys.stdout = out

            logger = Mann(console=True)
            logger.log('foo')

            output = out.getvalue().strip()

            self.assertEqual(output, 'foo')
        finally:
            sys.stdout = sys.__stdout__

        try:
            out = StringIO()
            sys.stdout = out

            logger = Mann()
            logger.log('foo')

            output = out.getvalue().strip()

            self.assertEqual(output, '')
        finally:
            sys.stdout = sys.__stdout__


def suite():
    """Compose and return test suite."""
    suite = unittest.TestSuite()
    suite.addTest(ConsoleTestCase())
    return suite

if __name__ == '__main__':
    runner = crunner.ColourTextTestRunner()
    runner.run(suite())

Create test for console output.
Create test for console output.

  """Test suite for Mann."""
  # -*- coding: utf-8 -*-
+ import sys
  import unittest
+ from io import StringIO
  from colour_runner import runner as crunner
- # from mypleasure.mann import Mann
+ from mypleasure.mann import Mann
  
  
  class ConsoleTestCase(unittest.TestCase):
      """Test console logger."""
  
      def runTest(self): # noqa
-         pass
+         try:
+             out = StringIO()
+             sys.stdout = out
+ 
+             logger = Mann(console=True)
+             logger.log('foo')
+ 
+             output = out.getvalue().strip()
+ 
+             self.assertEqual(output, 'foo')
+         finally:
+             sys.stdout = sys.__stdout__
+ 
+         try:
+             out = StringIO()
+             sys.stdout = out
+ 
+             logger = Mann()
+             logger.log('foo')
+ 
+             output = out.getvalue().strip()
+ 
+             self.assertEqual(output, '')
+         finally:
+             sys.stdout = sys.__stdout__
  
  
  def suite():
      """Compose and return test suite."""
      suite = unittest.TestSuite()
      suite.addTest(ConsoleTestCase())
      return suite
  
  if __name__ == '__main__':
      runner = crunner.ColourTextTestRunner()
      runner.run(suite())
  
Create test for console output.
## Code Before:
"""Test suite for Mann."""
# -*- coding: utf-8 -*-
import unittest
from colour_runner import runner as crunner
# from mypleasure.mann import Mann


class ConsoleTestCase(unittest.TestCase):
    """Test console logger."""

    def runTest(self): # noqa
        pass


def suite():
    """Compose and return test suite."""
    suite = unittest.TestSuite()
    suite.addTest(ConsoleTestCase())
    return suite

if __name__ == '__main__':
    runner = crunner.ColourTextTestRunner()
    runner.run(suite())

## Instruction:
Create test for console output.
## Code After:
"""Test suite for Mann."""
# -*- coding: utf-8 -*-
import sys
import unittest
from io import StringIO
from colour_runner import runner as crunner
from mypleasure.mann import Mann


class ConsoleTestCase(unittest.TestCase):
    """Test console logger."""

    def runTest(self): # noqa
        try:
            out = StringIO()
            sys.stdout = out

            logger = Mann(console=True)
            logger.log('foo')

            output = out.getvalue().strip()

            self.assertEqual(output, 'foo')
        finally:
            sys.stdout = sys.__stdout__

        try:
            out = StringIO()
            sys.stdout = out

            logger = Mann()
            logger.log('foo')

            output = out.getvalue().strip()

            self.assertEqual(output, '')
        finally:
            sys.stdout = sys.__stdout__


def suite():
    """Compose and return test suite."""
    suite = unittest.TestSuite()
    suite.addTest(ConsoleTestCase())
    return suite

if __name__ == '__main__':
    runner = crunner.ColourTextTestRunner()
    runner.run(suite())
