def test_user_dictionary_with_progress(self):
    progress_indicator = SimpleProgressIndicator(update_frequency=1.0)
    with self.assertLogs(logger=p_logger) as cm:
        large_user_dic = UserDictionary(user_dict=os.path.join(parent_dir, 'tests/user_ipadic.csv'), enc='utf8', type='ipadic', connections=connections, progress_handler=progress_indicator)
        entry_count = len(large_user_dic.entries)
        self.assertEqual(((entry_count + 1) * 2), len(cm.output))
        self.assertIsNone(progress_indicator.value)
        for i in range(0, ((entry_count + 1) * 2)):
            if (i < entry_count):
                self.assertIn('Reading user dictionary from CSV', cm.output[i])
                self.assertIn(f'{(i + 1)}/{entry_count}', cm.output[i])
            elif (i == entry_count):
                self.assertIn(f'{entry_count}/{entry_count}', cm.output[i])
            elif (i < ((entry_count * 2) + 1)):
                self.assertIn('Running create_minimum_transducer', cm.output[i])
                self.assertIn(f'{(i - entry_count)}/{entry_count}', cm.output[i])
            elif (i == ((entry_count * 2) + 1)):
                self.assertIn(f'{entry_count}/{entry_count}', cm.output[i])
    self.assertEqual(1, len(large_user_dic.lookup('東京スカイツリー'.encode('utf8'))))
def test_user_dictionary_with_progress(self):
    progress_indicator = SimpleProgressIndicator(update_frequency=1.0)
    with self.assertLogs(logger=p_logger) as cm:
        large_user_dic = UserDictionary(user_dict=os.path.join(parent_dir, 'tests/user_ipadic.csv'), enc='utf8', type='ipadic', connections=connections, progress_handler=progress_indicator)
        entry_count = len(large_user_dic.entries)
        self.assertEqual(((entry_count + 1) * 2), len(cm.output))
        self.assertIsNone(progress_indicator.value)
        for i in range(0, ((entry_count + 1) * 2)):
            if (i < entry_count):
                self.assertIn('Reading user dictionary from CSV', cm.output[i])
                self.assertIn(f'{(i + 1)}/{entry_count}', cm.output[i])
            elif (i == entry_count):
                self.assertIn(f'{entry_count}/{entry_count}', cm.output[i])
            elif (i < ((entry_count * 2) + 1)):
                self.assertIn('Running create_minimum_transducer', cm.output[i])
                self.assertIn(f'{(i - entry_count)}/{entry_count}', cm.output[i])
            elif (i == ((entry_count * 2) + 1)):
                self.assertIn(f'{entry_count}/{entry_count}', cm.output[i])
    self.assertEqual(1, len(large_user_dic.lookup('東京スカイツリー'.encode('utf8'))))