'Test to ensure a ReferenceField can store a reference to a parent
class when inherited. Issue #954.'

def test_parent_reference_in_child_document(self):

    class Parent(Document, ):
        meta = {'allow_inheritance': True}
        reference = ReferenceField('self')
    class Child(Parent, ):
        pass
    parent = Parent()
    parent.save()
    child = Child(reference=parent)
    try:
        child.save()
    except ValidationError as e:
        self.fail(('ValidationError    raised:    %s' % e.message))
