basic.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Lixiang_zhaoxin 作者: hejaxian 项目源码 文件源码
def test_enctype_debug_helper(self):
        from flask.debughelpers import DebugFilesKeyError
        app = flask.Flask(__name__)
        app.debug = True
        @app.route('/fail', methods=['POST'])
        def index():
            return flask.request.files['foo'].filename

        # with statement is important because we leave an exception on the
        # stack otherwise and we want to ensure that this is not the case
        # to not negatively affect other tests.
        with app.test_client() as c:
            try:
                c.post('/fail', data={'foo': 'index.txt'})
            except DebugFilesKeyError as e:
                self.assert_in('no file contents were transmitted', str(e))
                self.assert_in('This was submitted: "index.txt"', str(e))
            else:
                self.fail('Expected exception')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号