def test_mongoengine_field_references_self():
from mongoengine import Document, ReferenceField
class Test(Document):
parent = ReferenceField('self')
with pytest.raises(Exception) as e_info:
Options('TestSchema', {'model': Test})
assert str(e_info.value) == "It was not possible to generate schema for {} because the field {} is a " \
"ReferenceField to self and this is not supported yet."\
.format("TestSchema", 'parent')
评论列表
文章目录