def test_document_move_with_multiple_tags(self): scope = Scope(database=self._database) scope.add_tag(2) scope.add_tag(3) scope.add_tag(6) self.assertEqual(scope.get_concept_document_ids(), []) self.assertEqual(set(scope.get_concept_tag_ids()), {2, 3, 6}) self.assertEqual(scope.get_selection_document_ids(), []) self.assertEqual(set(scope.get_selection_tag_ids()), {1, 2, 3, 4, 5, 6}) self.assertEqual(scope.get_concept_only_document_ids(), []) self.assertEqual(set(scope.get_selection_only_tag_ids()), {1, 4, 5}) scope.move_document(6) self.assertEqual(scope.get_concept_document_ids(), [6]) self.assertEqual(set(scope.get_concept_tag_ids()), {2, 3, 6}) self.assertEqual(scope.get_selection_document_ids(), []) self.assertEqual(set(scope.get_selection_tag_ids()), {1, 2, 3, 4, 5, 6}) self.assertEqual(scope.get_concept_only_document_ids(), [6]) self.assertEqual(set(scope.get_selection_only_tag_ids()), {1, 4, 5}) scope.select_document(6) self.assertEqual(scope.get_concept_document_ids(), [6]) self.assertEqual(set(scope.get_concept_tag_ids()), {2, 3, 6}) self.assertEqual(scope.get_selection_document_ids(), [6]) self.assertEqual(set(scope.get_selection_tag_ids()), {2, 3, 6}) self.assertEqual(scope.get_concept_only_document_ids(), []) self.assertEqual(scope.get_selection_only_tag_ids(), [])
def test_single_document_move_to_root(self): scope = Scope(database=self._database) scope.move_document(7) self.assertEqual(set(scope.get_concept_document_ids()), {1, 2, 3, 4, 5, 6, 7, 8}) self.assertEqual(scope.get_concept_tag_ids(), []) self.assertEqual(scope.get_selection_document_ids(), []) self.assertEqual(set(scope.get_selection_tag_ids()), {1, 2, 3, 4, 5, 6}) self.assertEqual(set(scope.get_concept_only_document_ids()), {1, 2, 3, 4, 5, 6, 7, 8}) self.assertEqual(set(scope.get_selection_only_tag_ids()), {1, 2, 3, 4, 5, 6}) scope.select_document(7) self.assertEqual(set(scope.get_concept_document_ids()), {1, 2, 3, 4, 5, 6, 7, 8}) self.assertEqual(scope.get_concept_tag_ids(), []) self.assertEqual(scope.get_selection_document_ids(), [7]) self.assertEqual(scope.get_selection_tag_ids(), []) self.assertEqual(set(scope.get_concept_only_document_ids()), {1, 2, 3, 4, 5, 6, 8}) self.assertEqual(scope.get_selection_only_tag_ids(), [])
def test_document_move_with_single_tag(self): scope = Scope(database=self._database) scope.add_tag(6) self.assertEqual(set(scope.get_concept_document_ids()), {4, 7}) self.assertEqual(scope.get_concept_tag_ids(), [6]) self.assertEqual(set(scope.get_selection_tag_ids()), {1, 2, 3, 4, 5, 6}) self.assertEqual(set(scope.get_selection_only_tag_ids()), {1, 2, 3, 4, 5}) scope.move_document(2) self.assertEqual(set(scope.get_concept_document_ids()), {2, 4, 7}) self.assertEqual(scope.get_concept_tag_ids(), [6]) self.assertEqual(scope.get_selection_document_ids(), []) self.assertEqual(set(scope.get_selection_tag_ids()), {1, 2, 3, 4, 5, 6}) self.assertEqual(set(scope.get_concept_only_document_ids()), {2, 4, 7}) self.assertEqual(set(scope.get_selection_only_tag_ids()), {1, 2, 3, 4, 5}) scope.remove_tag(6) self.assertEqual(set(scope.get_concept_document_ids()), {1, 2, 3, 4, 5, 6, 7, 8}) self.assertEqual(scope.get_concept_tag_ids(), []) self.assertEqual(scope.get_selection_document_ids(), []) self.assertEqual(set(scope.get_selection_tag_ids()), {1, 2, 3, 4, 5, 6}) self.assertEqual(set(scope.get_concept_only_document_ids()), {1, 2, 3, 4, 5, 6, 7, 8}) self.assertEqual(set(scope.get_selection_only_tag_ids()), {1, 2, 3, 4, 5, 6}) scope.select_document(2) self.assertEqual(set(scope.get_concept_document_ids()), {1, 2, 3, 4, 5, 6, 7, 8}) self.assertEqual(scope.get_concept_tag_ids(), []) self.assertEqual(scope.get_selection_document_ids(), [2]) self.assertEqual(scope.get_selection_tag_ids(), [6]) self.assertEqual(set(scope.get_concept_only_document_ids()), {1, 3, 4, 5, 6, 7, 8}) self.assertEqual(scope.get_selection_only_tag_ids(), [6])
def test_invalid_document_move(self): scope = Scope(database=self._database) with self.assertRaises(ValueError): scope.move_document(9)