知识卡片

普通读书笔记卡 · 8759 · 生成模型:GPT-6

区间匹配器不能用语言与代替

理解等级:高级

Python的and按对象真假返回其中一个对象,不会自动把两个匹配器合成区间检查。要用库支持的组合方式或显式双边比较,并实际验证上下界都生效;原书示例还缺括号,不能直接当可运行模板。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      is_mapping({"prediction": greater_than_or_equal_to(0) and less_than_or_equal_to(4), "request": valid_request_payload}) Assuming you’ve defined a handler for requests for "/" that returns a hello world message, you can write a simple assertion like this to test that the endpoint handler returns the expected response. A readable test name. We’ve opted for the format of: “{the endpoint path} (/predict) returns {expected output} when given {a type of input}.” You can further

    参考来源

    - 位置:《Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)》第05章《软件自动化测试》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)/_epub-src/OEBPS/ch05.html) - 结论依据:摘录中关于区间匹配器不能用语言与代替的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:is_mapping({"prediction": greater_than_or_equal_to(0) and less_than_or_equal_to(4), "request": valid_request_payload}) Assuming you’ve defined a handler for requests for "/" that returns a hello world message, you can write a simple assertion like this to test that the endpoint handler returns the expected response. A readable test name. We’ve opted for the format of: “{the endpoint path} (/predict) returns {expected output} when given {a type of input}.” You can further