class TD(BaseDoc): field1 = StringField() field2 = IntField() field3 = DocumentField(ITD)
class TD(BaseDoc): dict_field = DictField(DocumentField(ITD)) list_field = ListField(DocumentField(ITD)) model_field = DocumentField(ITD)
class InDictTD(BaseDoc): field1 = DateTimeField(default=dt_now) field2 = ListField(DocumentField(InListTD))
class TD(BaseDoc): field1 = StringField() field2 = DictField(DocumentField(InDictTD))
class TD(BaseDoc): field1 = ListField(DocumentField(ITD))
class TD(BaseDoc): field1 = StringField() field2 = ListField(DocumentField(ITD))
class TD(BaseDoc): field1 = DictField(DocumentField(ITD))
class TD(BaseDoc): doc_field = DocumentField(ITD)
def test_should_accept_document_class_as_model_class(self): field = DocumentField(BaseDoc) assert field.model_class == BaseDoc
def test_should_load_model_class_dynamically(self): field = DocumentField('tests.common.BaseDoc') assert field.model_class == BaseDoc
def test_should_accept_string_as_model_class(self): field = DocumentField('tests.common.BaseDoc') assert field.model_class == BaseDoc