← 返回起始笔记位置

知识卡片

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

不同环境测试复用需要显式配置

理解等级:中级

以配置选择目标端点和测试身份,可复用部署后检查并读取实际日志。要确认目标、认证和副作用范围,生产测试与本地替身测试性质不同;不能未经区分把同一负载发送到任意真实系统。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      endpoint_url = "https://my-model-api.example.com" def test_root(self): response = requests.get(self.endpoint_url) assert response.status_code == 200 def test_predict_should_return_a_prediction_when_given_a_valid_payload(self): valid_request_payload = { "Changed_Credit_Limit": 0, "Annual_Income": 0, "Monthly_Inhand_Salary": 0, "Age": 0, } response = requests.post(f"{self.endpoint_url}/predict/", headers={"Content-Type": "application/json"}, json=valid_request_payload ) assert response.status_code == 200

    参考来源

    - 位置:《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) - 结论依据:摘录中关于不同环境测试复用需要显式配置的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:endpoint_url = "https://my-model-api.example.com" def test_root(self): response = requests.get(self.endpoint_url) assert response.status_code == 200 def test_predict_should_return_a_prediction_when_given_a_valid_payload(self): valid_request_payload = { "Changed_Credit_Limit": 0, "Annual_Income": 0, "Monthly_Inhand_Salary": 0, "Age": 0, } response = requests.post(f"{self.endpoint_url}/predict/", headers={"Content-Type": "application/json"}, json=valid_request_payload ) assert response.status_code == 200