コード例 #1
0
 def test5reset_after_report_flag(self):
     """This unittest tests the functionality of the reset_after_report flag."""
     parser_count = ParserCount(
         self.aminer_config,
         ['fixed/seq', 'fixed/seq/m1', 'fixed/seq/m2', 'fixed/m3'],
         [self.stream_printer_event_handler], 600, False)
     parser_count.count_dict['fixed/seq'] = 5
     parser_count.count_dict['fixed/seq/m1'] = 5
     parser_count.count_dict['fixed/seq/m2'] = 5
     parser_count.count_dict['fixed/m3'] = 17
     old_count_dict = dict(parser_count.count_dict)
     parser_count.send_report()
     self.assertEqual(parser_count.count_dict, old_count_dict)
     parser_count.reset_after_report_flag = True
     parser_count.send_report()
     old_count_dict['fixed/seq'] = 0
     old_count_dict['fixed/seq/m1'] = 0
     old_count_dict['fixed/seq/m2'] = 0
     old_count_dict['fixed/m3'] = 0
     self.assertEqual(parser_count.count_dict, old_count_dict)
コード例 #2
0
 def test5resetting(self):
     """This unittest tests the functionality of resetting the counts."""
     parser_count = ParserCount(self.aminer_config, ['fixed/seq', 'fixed/seq/m1', 'fixed/seq/m2', 'fixed/m3'],
                                [self.stream_printer_event_handler], 600)
     parser_count.count_dict['fixed/seq'][current_processed_lines_str] = 5
     parser_count.count_dict['fixed/seq'][total_processed_lines_str] = 5
     parser_count.count_dict['fixed/seq/m1'][current_processed_lines_str] = 5
     parser_count.count_dict['fixed/seq/m1'][total_processed_lines_str] = 5
     parser_count.count_dict['fixed/seq/m2'][current_processed_lines_str] = 5
     parser_count.count_dict['fixed/seq/m2'][total_processed_lines_str] = 5
     parser_count.count_dict['fixed/m3'][current_processed_lines_str] = 17
     parser_count.count_dict['fixed/m3'][total_processed_lines_str] = 17
     old_count_dict = dict(parser_count.count_dict)
     parser_count.send_report()
     self.assertEqual(parser_count.count_dict, old_count_dict)
     parser_count.send_report()
     old_count_dict['fixed/seq'][current_processed_lines_str] = 0
     old_count_dict['fixed/seq/m1'][current_processed_lines_str] = 0
     old_count_dict['fixed/seq/m2'][current_processed_lines_str] = 0
     old_count_dict['fixed/m3'][current_processed_lines_str] = 0
     self.assertEqual(parser_count.count_dict, old_count_dict)