'Ensure that ReferenceFields may reference undefined Documents.'

def test_undefined_reference(self):

    class Product(Document, ):
        name = StringField()
        company = ReferenceField('Company')
    class Company(Document, ):
        name = StringField()
    Product.drop_collection()
    Company.drop_collection()
    ten_gen = Company(name='10gen')
    ten_gen.save()
    mongodb = Product(name='MongoDB', company=ten_gen)
    mongodb.save()
    me = Product(name='MongoEngine')
    me.save()
    obj = Product.objects(company=ten_gen).first()
    self.assertEqual(obj, mongodb)
    self.assertEqual(obj.company, ten_gen)
    obj = Product.objects(company=None).first()
    self.assertEqual(obj, me)
    obj = Product.objects.get(company=None)
    self.assertEqual(obj, me)
