伪代码 ,只帖了关键部分
class test(unittest.TestCase):
def tobase64(self, img):
with open(img, "rb") as f:
base64_img = base64.b64encode(f.read())
baseimg = str(base64_img).split("'")[1]
return baseimg
@parameterized.expand([('', '', '', '200'),
('', '123', '', '200'),
(self.tobase64(img), str(uuid.uuid4()), 0, 000)])
def test_case1(self):
pass
报错如下:
File "E:\intellif\shijuPK\sjpk.py", line 41, in PK
(self.tobase64(img), str(uuid.uuid4()), 0, 000)])
NameError: name 'self' is not defined