Пример #1
0
 def test_document_destroying(self):
     scope = Scope(database=self._database)
     document_counts = {
         1: [4, 3, 2, 1, 1, 0, 0, 0, 0],
         2: [3, 2, 2, 2, 1, 0, 0, 0, 0],
         3: [3, 3, 2, 2, 2, 2, 2, 1, 0],
         4: [2, 2, 2, 1, 1, 1, 0, 0, 0],
         5: [3, 3, 3, 3, 3, 2, 1, 1, 0],
         6: [2, 2, 2, 2, 1, 1, 1, 0, 0]
     }
     for i in range(9):
         if i > 0:
             scope.destroy_document(i)
         for tag_id in range(1, 7):
             scope.add_tag(tag_id)
             self.assertEqual(len(scope.get_concept_documents()),
                              document_counts[tag_id][i])
             scope.remove_tag(tag_id)
Пример #2
0
 def test_duplicated_document_destroying(self):
     scope = Scope(database=self._database)
     for document_id in range(1, 9):
         scope.destroy_document(document_id)
         with self.assertRaises(ValueError):
             scope.destroy_document(document_id)
Пример #3
0
 def test_invalid_document_destroying(self):
     scope = Scope(database=self._database)
     with self.assertRaises(ValueError):
         scope.destroy_document(9)