Base test case class for python unittest
I have a pile of objects "implementing" the same "interface". There are a
few common behaviors that they all should exhibit, and that I thus want to
test for in all those classes.
I was thinking of having an abstract base test case with the common stuff
that is then derived from by specific test cases. There is at least one
abstract method in this base test class that is called from the base class
itself and needs to be defined in derivatives. I'm not sure how to call
the method defined in the derivative from the base class though. If I do
self.abstract_method, it'll say the method is not defined. How can I call
this method?
If there is a better way of achieving my test goals here that does not
involve inheritance, I'd be happy to hear about it.
No comments:
Post a Comment