def test_create_with_document_class(self):
        # copying standard DBNAME, so this DB gets also deleted by tearDown
        self.app.config['CUSTOM_DBNAME'] = self.app.config['MONGO_DBNAME']
        self.app.config['CUSTOM_DOCUMENT_CLASS'] = CustomDict
        # not using self.mongo, because we want to use updated config
        # also using CUSTOM, to avoid duplicate config_prefix exception
        mongo = flask.ext.pymongo.PyMongo(self.app, 'CUSTOM')
        assert mongo.db.things.find_one() is None
        # write document and retrieve, to check if type is really CustomDict
        if pymongo.version_tuple[0] > 2:
            # Write Concern is set to w=1 by default in pymongo > 3.0
            mongo.db.things.insert_one({'_id': 'thing', 'val': 'foo'})
        else:
            mongo.db.things.insert({'_id': 'thing', 'val': 'foo'}, w=1)
        assert type(mongo.db.things.find_one()) == CustomDict
This test doesn't use self.mongo, because it has to change config
dataset/ETHPy150Open dcrosta/flask-pymongo/tests/test_config.py/CustomDocumentClassTest.test_create_with_document_class