[BangPypers] issues using constructor in unittest
navin.kabra at gmail.com
Mon Mar 14 09:54:59 CET 2011
On Mon, Mar 14, 2011 at 1:56 PM, Nitin Kumar <nitin.nitp at gmail.com> wrote:
> See below small example. I am trying to have one constructor for a class
> with unittest inherited.
Avoid overriding the constructor of TestCase. That is not recommended.
> self.x = 3
Put this is "setUp" instead of the constructor
If you must do this, the correct way of doing it is:
def __init__(self, *args, **kwargs):
super(XMLSupport, self).__init__(*args, **kwargs)
self.x = 3
More information about the BangPypers