Beispiel #1
0
 def save_errors(self, errors):
     YLogger.info(self, "Saving errors to Mongo")
     for duplicate in errors:
         db_duplicate = Duplicate(duplicate=duplicate[0],
                                  file=duplicate[1],
                                  start=duplicate[2],
                                  end=duplicate[3])
         self.add_document(db_duplicate)
Beispiel #2
0
    def test_init_no_id(self):
        duplicate = Duplicate(duplicate="This is a duplicate", file='afile', start='300', end='500')

        self.assertIsNotNone(duplicate)
        self.assertIsNone(duplicate.id)
        self.assertEqual('This is a duplicate', duplicate.duplicate)
        self.assertEqual('afile', duplicate.file)
        self.assertEqual('300', duplicate.start)
        self.assertEqual('500', duplicate.end)
        self.assertEqual({'duplicate': 'This is a duplicate', 'end': '500', 'file': 'afile', 'start': '300'}, duplicate.to_document())
 def save_duplicates(self, duplicates):
     YLogger.debug(self, "Saving duplicates to Mongo")
     for duplicate in duplicates:
         db_duplicate = Duplicate(duplicate=duplicate[0], file=duplicate[1], start=duplicate[2], end=duplicate[3])
         self.add_document(db_duplicate)