Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何模仿<;ModelClass>;。query.filter在烧瓶SQLAlchemy中_Python_Unit Testing_Pytest_Flask Sqlalchemy - Fatal编程技术网

Python 如何模仿<;ModelClass>;。query.filter在烧瓶SQLAlchemy中

Python 如何模仿<;ModelClass>;。query.filter在烧瓶SQLAlchemy中,python,unit-testing,pytest,flask-sqlalchemy,Python,Unit Testing,Pytest,Flask Sqlalchemy,我无法对项目中的特定代码块进行单元测试。 以下是代码片段: @process_bp.route("/getListCSV") def get_list_csv(): industry_sele = "All" #rest of code if industry_sele != "All": companies_flask_list = Companies.query.filter(Companie

我无法对项目中的特定代码块进行单元测试。 以下是代码片段:

@process_bp.route("/getListCSV")
def get_list_csv():
    industry_sele = "All"
    #rest of code
    if industry_sele != "All":
        companies_flask_list = Companies.query.filter(Companies.industry_desc == industry_sele)
我已经尝试了从这里编写单元测试用例的所有方法-> 测试用例通过了,但是测试用例没有覆盖代码片段。原因可能是什么?如何以适当的方式做这件事?请帮忙