在接口测试中,完整的断言应覆盖接口响应的多个维度。以下是使用 pytest 进行接口测试时需要断言的关键信息及代码示例: 一、核心断言维度 1. HTTP状态码 def test_status_code(api_client): response = api_client.get("/api/users/1") assert response.status_code