'Make sure multiple layers of embedded docs resolve db fields
from SON properly.'

def test_double_embedded_db_field_from_son(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._from_son(SON([('fb', SON([('fc', SON([('txt', 'hi')]))]))]))
    self.assertEqual(a.b.c.txt, 'hi')
