总提示我未安装numpy是为什么?
来源:5-2 case中如何进行mock数据
慕运维1881141
2019-10-28
#coding = utf-8
import unittest
import mock
import requests
url = "http://www.baidu.com"
data = {
“username”:“hjw”,
“password”:“1111”
}
def post_requests(url,data):
res = requests.post(url,data).json()
return res
class test_login(unittest.TestCase):
def setUp(self):
print(“case开始执行”)
def tearDown(self):
print("case执行结束")
def test_01(self):
url = "http://imooc.com/login/register"
data = {
"username":"1111"
}
mock_value = mock.Mock(return_value=data)
print(mock_value)
post_requests = mock_value
res = post_requests
self.assertEqual("2222",res())
写回答
2回答
-
这个是因为你安装的python包是科学计算那个
012019-11-04 -
慕运维1881141
提问者
2019-10-28
在anaconda prompt下安装/升级numpy即可
00
相似问题