'Ensure reference cascading doesn\'t loop if reference graph isn\'t
a tree'

def test_reverse_delete_rule_cascade_cycle(self):

    class Dummy(Document, ):
        reference = ReferenceField('self', reverse_delete_rule=CASCADE)
    base = Dummy().save()
    other = Dummy(reference=base).save()
    base.reference = other
    base.save()
    base.delete()
    self.assertRaises(DoesNotExist, base.reload)
    self.assertRaises(DoesNotExist, other.reload)
