<commit_before>"""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())<commit_msg>Rename console test, stub tests for file logger.<commit_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 ConsoleTestCasePrintsOutputToConsole(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__


class FileTestCaseLogsToFile(unittest.TestCase):
    """Test file logger outputs to file."""

    def runTest(self): # noqa
        pass


class FileTestCaseRaiseExceptionOnWriteErrorIfAllowed(unittest.TestCase):
    """Test file logger raises an exception on error, if allowed."""

    def runTest(self): # noqa
        pass


def suite():
    """Compose and return test suite."""
    suite = unittest.TestSuite()
    suite.addTest(ConsoleTestCasePrintsOutputToConsole())
    suite.addTest(FileTestCaseLogsToFile())
    suite.addTest(FileTestCaseRaiseExceptionOnWriteErrorIfAllowed())
    return suite

if __name__ == '__main__':
    runner = crunner.ColourTextTestRunner()
    runner.run(suite())
{'fraction_non_alphanumeric': 0.1110706482155863, 'fraction_numerical': 0.0007283321194464676, 'mean_word_length': 2.305655836341757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '270857', 'n_tokens_mistral': 755, 'n_tokens_neox': 736, 'n_words': 194}