def test_transform_update(self):
        class DicDoc(Document):
            dictField = DictField()

        class Doc(Document):
            pass

        DicDoc.drop_collection()
        Doc.drop_collection()

        doc = Doc().save()
        dic_doc = DicDoc().save()

        for k, v in (("set", "$set"), ("set_on_insert", "$setOnInsert"), ("push", "$push")):
            update = transform.update(DicDoc, **{k % "%s__dictField__test": doc})
            self.assertTrue(isinstance(update[v]["dictField.test"], dict))

        # Update special cases
        update = transform.update(DicDoc, unset__dictField__test=doc)
        self.assertEqual(update["$unset"]["dictField.test"], 1)

        update = transform.update(DicDoc, pull__dictField__test=doc)
        self.assertTrue(isinstance(update["$pull"]["dictField"]["test"], dict))
dataset/ETHPy150Open MongoEngine/mongoengine/tests/queryset/transform.py/TransformTest.test_transform_update/swapped operands of `%`