

def test_addition_and_deletion_of_documents(self):
    tag = Tag.objects.create(color=TEST_TAG_COLOR, label=TEST_TAG_LABEL)
    tag.documents.add(self.document)
    self.assertEqual(tag.documents.count(), 1)
    self.assertEqual(list(tag.documents.all()), [self.document])
    tag.documents.remove(self.document)
    self.assertEqual(tag.documents.count(), 0)
    self.assertEqual(list(tag.documents.all()), [])
    tag.delete()

dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/tags/tests/test_models.py TagTestCase.test_addition_and_deletion_of_documents/original