<commit_before>import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')

import unittest
import logging

from types import *
from mock import MagicMock
from core.registry import Registry
from core.container import Container
from core.exceptions.application import ContainerError

class FakeHandler(object):
    pass

class FakeApp1(Container):
    def routes(self):
        routes = [(r"/testing1", FakeHandler, "GET")]
        return routes

    def name(self):
        return "FakeApp1"

class FakeApp2(Container):
    def routes(self):
        routes = [(r"/testing2", FakeHandler, "GET")]
        return routes

    def name(self):
        return "FakeApp2"

class FakeApp3(object):
    """
    This class used to test exception
    """
    pass

class TestRegistry(unittest.TestCase):

    def test_build_registry(self):

        reg = Registry()
        reg.register(FakeApp1())
        reg.register(FakeApp2())

        # check if list of apps is not empty list
        self.assertIsNot(reg.get_apps(), [])
        self.assertEqual(2, len(reg.get_apps()))
        self.assertEqual(2, len(reg.get_routes()))

    def test_container_error(self):

        # test if application not implement container abstract class
        with self.assertRaises(ContainerError) as container_error:
            reg = Registry()
            reg.register(FakeApp3())

        exception = container_error.exception
        self.assertEqual('FakeApp3', exception.app_name)<commit_msg>Improve test registry to 100% code coverage<commit_after>import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')

import unittest
import logging

from types import *
from mock import MagicMock
from core.registry import Registry
from core.container import Container
from core.exceptions.application import ContainerError

class FakeHandler(object):
    pass

class FakeApp1(Container):
    def routes(self):
        routes = [(r"/testing1", FakeHandler, "GET")]
        return routes

    def name(self):
        return "FakeApp1"

class FakeApp2(Container):
    def routes(self):
        routes = [(r"/testing2", FakeHandler, "GET")]
        return routes

    def name(self):
        return "FakeApp2"

class FakeApp3(object):
    """
    This class used to test exception
    """
    pass

class FakeApp4(Container):
    def routes(self):
        routes = [(r"/testing3", FakeHandler, "GET", "testing")]
        return routes

    def name(self):
        return "FakeApp4"

class TestRegistry(unittest.TestCase):

    def test_build_registry(self):

        reg = Registry()
        reg.register(FakeApp1())
        reg.register(FakeApp2())
        reg.register(FakeApp4())

        # check if list of apps is not empty list
        self.assertIsNot(reg.get_apps(), [])
        self.assertEqual(3, len(reg.get_apps()))
        self.assertEqual(3, len(reg.get_routes()))

    def test_container_error(self):

        # test if application not implement container abstract class
        with self.assertRaises(ContainerError) as container_error:
            reg = Registry()
            reg.register(FakeApp3())

        exception = container_error.exception
        self.assertEqual('FakeApp3', exception.app_name)
{'fraction_non_alphanumeric': 0.10862227677201595, 'fraction_numerical': 0.010125805461798098, 'mean_word_length': 2.9853300733496333, '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': '4910150', 'n_tokens_mistral': 948, 'n_tokens_neox': 916, 'n_words': 243}