<commit_before>import os
import unittest
import shutil
from gos.assembler import AssemblyManager
from gos.configuration import Configuration

__author__ = 'aganezov'


class AssemblerManagerTestCase(unittest.TestCase):
    def setUp(self):
        self.config = Configuration()
        self.output_dir_name = self.config[Configuration.OUTPUT][Configuration.OUTPUT_DIRECTORY]
        if not os.path.exists(self.output_dir_name):
            os.mkdir(self.output_dir_name)
        self.assembler_manager = AssemblyManager()

    def tearDown(self):
        if os.path.exists(self.output_dir_name):
            shutil.rmtree(self.output_dir_name)

    def test_empty_initialization(self):
        manager = AssemblyManager()
        self.assertIsNotNone(manager.config)
        self.assertIsNotNone(manager.logger)

    def test_default_logger_name(self):
        self.assertEqual(self.assembler_manager.logger.name,
                         self.assembler_manager.config[Configuration.LOGGING][Configuration.LOGGER_NAME])

    def test_logger_format(self):
        self.assertEqual(self.assembler_manager.logger.level,
                         self.assembler_manager.config[Configuration.LOGGING][Configuration.LOGGING_LEVEL])


if __name__ == '__main__':
    unittest.main()<commit_msg>changed the behaviour of default AssemblyManager for the AssemblyManager TestCase supplementing real file handler to the mocking handler that does not write our, rather collects messages into internal data structure<commit_after>import os
import unittest
import shutil
from gos.assembler import AssemblyManager
from gos.configuration import Configuration
from tests.test_logging import MockingLoggingHandler

__author__ = 'aganezov'


class AssemblerManagerTestCase(unittest.TestCase):
    def setUp(self):
        self.config = Configuration()
        self.output_dir_name = self.config[Configuration.OUTPUT][Configuration.OUTPUT_DIRECTORY]
        if not os.path.exists(self.output_dir_name):
            os.mkdir(self.output_dir_name)
        self.assembler_manager = AssemblyManager()
        self.assembler_manager.logger.handlers = []
        self.mocking_handler = MockingLoggingHandler()
        self.mocking_handler.reset()
        self.assembler_manager.logger.addHandler(self.mocking_handler)

    def tearDown(self):
        if os.path.exists(self.output_dir_name):
            shutil.rmtree(self.output_dir_name)

    def test_empty_initialization(self):
        manager = AssemblyManager()
        self.assertIsNotNone(manager.config)
        self.assertIsNotNone(manager.logger)

    def test_default_logger_name(self):
        assembler_manager = AssemblyManager()
        self.assertEqual(assembler_manager.logger.name,
                         assembler_manager.config[Configuration.LOGGING][Configuration.LOGGER_NAME])

    def test_logger_format(self):
        assembler_manager = AssemblyManager()
        self.assertEqual(assembler_manager.logger.level,
                         assembler_manager.config[Configuration.LOGGING][Configuration.LOGGING_LEVEL])


if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.08033419023136247, 'fraction_numerical': 0.0, 'mean_word_length': 3.62555720653789, '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': '3360053', 'n_tokens_mistral': 864, 'n_tokens_neox': 855, 'n_words': 147}