我有以下单元测试用例。
import unittest
from webPageTestUtils import WebPageTestProcessor
class webPageUtilsTest(unittest.TestCase):
def setUp(self):
self.webPageTestProcessor = WebPageTestProcessor()
def test_submitTest(self):
url = None;
assertEqual(self.webPageTestProcessor.submitTest(url),None)
if __name__ == '__main__':
unittest.main()
执行后我收到错误说。
NameError: global name 'assertEqual' is not defined
我已经将unittest.TestCase子类化,那么为什么python不能识别assert
答案 0 :(得分:2)
这是self
上的方法:
self.assertEqual(self.webPageTestProcessor.submitTest(url), None)