PyHamcrest 断言
http://hamcrest.org/
import requests from hamcrest import * def test_post_json(self): payload = { "level": 1, "name": "xuefeifei" } r = requests.post("https://httpbin.testing-studio.com/post", json=payload) print(r.json() assert_that(r.json()["json"]["level"] ,equal_to(1))