python之unittest单元测试
现有一个自行封装的http_requests模块,用于测试http请求,内容如下: import requests class HttpRequests: def __init__(self,url,para): self.url = url self.para = para def http_requests(self,method): try: if method.lower() == 'get': response = requests.get(self.url,params=self.para) return response elif method.lower() == 'post': response = requests.post(self.url,data=self.para) return response elif method.lower() == 'delete': response = requests.delete(self.url,data=self.para) return response except Exception as e: print('请求错误:',e) 怎样利用python的unittest单元测试对其进行场景覆盖测试呢? 首先明确一下unittest单元测试步骤: 引入unittest模块