'Make sure multiple layers of embedded docs resolve db fields
properly and can be initialized using dicts.'

def test_double_embedded_db_field(self):

    class C(EmbeddedDocument, ):
        txt = StringField()
    class B(EmbeddedDocument, ):
        c = EmbeddedDocumentField(C, db_field='fc')
    class A(Document, ):
        b = EmbeddedDocumentField(B, db_field='fb')
    a = A(b=B(c=C(txt='hi')))
    a.validate()
    a = A(b={'c': {'txt': 'hi'}})
    a.validate()
