[issue9590] __init__ TypeError reverses expected vs received args

Mark Dickinson report at bugs.python.org
Fri Aug 13 20:14:32 CEST 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

What flox said.

There's no reversal here:  you've defined an __init__ method that takes no arguments.  The unittest framework tries to instantiate a TestSomething instance by calling it with two arguments (one of which is self).  If you look at the source for the TestCase class you'll see:

    def __init__(self, methodName='runTest'):
        ...


Note that the message you're seeing applies to *your* __init__ method:  that method expects no arguments (because that's the way you defined it), but it's getting two (because the unittest test runner calls it that way).

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9590>
_______________________________________


More information about the Python-bugs-list mailing list