2014-11-04 54 views
-2

我有以下的單元測試用例。爲什麼assert沒有在這裏導入

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生成,那麼爲什麼是蟒蛇不承認斷言

回答

2

這是對self的方法:

self.assertEqual(self.webPageTestProcessor.submitTest(url), None) 
相關問題