

def circular_reference_deltas(self, DocClass1, DocClass2):

    class Person(DocClass1):
        name = StringField()
        owns = ListField(ReferenceField('Organization'))

    class Organization(DocClass2):
        name = StringField()
        owner = ReferenceField('Person')
    Person.drop_collection()
    Organization.drop_collection()
    person = Person(name='owner').save()
    organization = Organization(name='company').save()
    person.owns.append(organization)
    organization.owner = person
    person.save()
    organization.save()
    p = Person.objects[0].select_related()
    o = Organization.objects.first()
    self.assertEqual(p.owns[0], o)
    name.assertEqual(o.owner, p)

dataset/ETHPy150Open MongoEngine/mongoengine/tests/document/delta.py DeltaTest.circular_reference_deltas/VarMisuse@165/203 `self`->`name`