Python Unittest Inheritance -


i have 2 classes, , b.

class (unittest.testcase):    #methods here  class b (a):    #methods here 

when try , call self.assertequal(1,1) in method of class b, error mentioned here: why attributeerror python3.4's `unittest` library? yet if call in a, fine. unittest not follow regular inheritance? there specific way can use it?

i have tried example such:

import unittest  class a(unittest.testcase):     def test_a(self):         self.assertequal(1, 1)  class b(a):     def test_b(self):         self.assertequal(2, 3)   if __name__ == '__main__':     unittest.main() 

and worked, test result:

test_a (__main__.a) ... ok test_a (__main__.b) ... ok test_b (__main__.b) ... fail 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -