def test_remove_substrings(self):
        """
        Doesn't include substring words in the output dictionary
        """
        test_counts = {'corgi':     10,  # score 50
                       'corgicat':   5}  # score 40

        expected_dict = 'corgicat'
        d = zdict_gen.genDictFromFreq(test_counts, -1)
        self.assertEqual(d, expected_dict)
Exemple #2
0
    def test_remove_substrings(self):
        """
        Doesn't include substring words in the output dictionary
        """
        test_counts = {
            'corgi': 10,  # score 50
            'corgicat': 5
        }  # score 40

        expected_dict = 'corgicat'
        d = zdict_gen.genDictFromFreq(test_counts, -1)
        self.assertEqual(d, expected_dict)
 def test_is_corrrect_order(self):
     """
     Should correctly score and generate dictionary
     """
     test_counts = {'corgi':  10,  # score 50
                    'cat':     5,  # score 15
                    'lizard':  6,  # score 36
                    'gecko':   7,  # score 35
                    'hamster': 4,  # score 28
                    'parrot':  3}  # score 18
     full_dict = zdict_gen.genDictFromFreq(test_counts, -1)
     expected_dict = 'catparrothamstergeckolizardcorgi'
     self.assertEqual(full_dict, expected_dict)
Exemple #4
0
 def test_is_corrrect_order(self):
     """
     Should correctly score and generate dictionary
     """
     test_counts = {
         'corgi': 10,  # score 50
         'cat': 5,  # score 15
         'lizard': 6,  # score 36
         'gecko': 7,  # score 35
         'hamster': 4,  # score 28
         'parrot': 3
     }  # score 18
     full_dict = zdict_gen.genDictFromFreq(test_counts, -1)
     expected_dict = 'catparrothamstergeckolizardcorgi'
     self.assertEqual(full_dict, expected_dict)
    def test_equal_to_size_b(self):
        """
        Output of dictionary should be equal to size_b if size_b is valid and
        the unlimited dictionary would have been larger than size_b
        """
        test_counts = {'corgi':  10,  # score 50
                       'cat':     5,  # score 15
                       'lizard':  6,  # score 36
                       'gecko':   7,  # score 35
                       'hamster': 4,  # score 28
                       'parrot':  3}  # score 18

        expected_dict = 'geckolizardcorgi'
        expected_size = len(expected_dict)
        small_dict = zdict_gen.genDictFromFreq(test_counts, expected_size)
        self.assertEqual(small_dict, expected_dict)
Exemple #6
0
    def test_equal_to_size_b(self):
        """
        Output of dictionary should be equal to size_b if size_b is valid and
        the unlimited dictionary would have been larger than size_b
        """
        test_counts = {
            'corgi': 10,  # score 50
            'cat': 5,  # score 15
            'lizard': 6,  # score 36
            'gecko': 7,  # score 35
            'hamster': 4,  # score 28
            'parrot': 3
        }  # score 18

        expected_dict = 'geckolizardcorgi'
        expected_size = len(expected_dict)
        small_dict = zdict_gen.genDictFromFreq(test_counts, expected_size)
        self.assertEqual(small_dict, expected_dict)