<commit_before><commit_msg>test(business): add Lexical_Unit, Dictionary<commit_after>import unittest


class LexicalUnit(object):
    def __init__(self, name):
        self.definitions = []
        self.name = name

    def add_definition(self, definition):
        self.definitions.append(definition)

    def get_definitions(self, word):
        for definition in self.definitions:
            if word in definition:
                return [definition]


class LexicalUnitTestCase(unittest.TestCase):
    def test_lexical_unit_has_definitions(self):
        name = 'pakeha'
        lexical_unit = LexicalUnit(name)

        self.assertEqual(name, lexical_unit.name)
        self.assertEqual([], lexical_unit.definitions)

    def test_lexical_unit_can_have_several_definitions(self):
        lexical_unit = LexicalUnit('pā')
        lexical_unit.add_definition('toucher')
        lexical_unit.add_definition('être connecté')
        self.assertEqual(2, len(lexical_unit.definitions))


class Dictionary(object):
    def __init__(self):
        self.lexical_units = []

    def add_lexical_unit(self, lexical_unit):
        self.lexical_units.append(lexical_unit)


class DictionaryTestCase(unittest.TestCase):
    def test_dictionary_has_lexical_units(self):
        dictionary = Dictionary()
        
        self.assertEqual([], dictionary.lexical_units)

    def test_can_add_lexical_unit(self):
        dictionary = Dictionary()
        lexical_unit = LexicalUnit('pā')
        dictionary.add_lexical_unit(lexical_unit)

        self.assertEqual([lexical_unit], dictionary.lexical_units)

if __name__ == '__main__':
    unittest.main()

{'fraction_non_alphanumeric': 0.09378806333739342, 'fraction_numerical': 0.0006090133982947625, 'mean_word_length': 3.4285714285714284, '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': '7409976', 'n_tokens_mistral': 504, 'n_tokens_neox': 481, 'n_words': 81}