def test_tag_destroying(self): scope = Scope(database=self._database) tag_counts = { 1: [2, 1, 0, 0, 0, 0, 0], 2: [2, 1, 1, 0, 0, 0, 0], 3: [2, 1, 1, 1, 0, 0, 0], 4: [2, 2, 1, 1, 1, 1, 0], 5: [3, 2, 1, 1, 1, 0, 0], 6: [2, 2, 2, 2, 1, 0, 0], 7: [2, 2, 2, 1, 1, 1, 0], 8: [2, 2, 2, 1, 1, 0, 0] } for i in range(7): if i > 0: scope.destroy_tag(i) for document_id in range(1, 9): scope.select_document(document_id) self.assertEqual(len(scope.get_selection_only_tags()), tag_counts[document_id][i]) scope.deselect_document(document_id)
def test_duplicated_tag_destroying(self): scope = Scope(database=self._database) for tag_id in range(1, 7): scope.destroy_tag(tag_id) with self.assertRaises(ValueError): scope.destroy_tag(tag_id)
def test_invalid_tag_destroying(self): scope = Scope(database=self._database) with self.assertRaises(ValueError): scope.destroy_tag(0) with self.assertRaises(ValueError): scope.destroy_tag(11)