[issue9590] __init__ TypeError reverses expected vs received args
New submission from Anthony Long antl...@gmail.com: import unittest from selenium import selenium class SetupSomething(unittest.TestCase): def setUp(self, URL): self.selenium = selenium(localhost, , *firefox, self.URL) def tearDown(self): pass class TestSomething(SetupSomething): def __init__(): print bug. def setUp(self): self.URL = http://google.com/; def tearDown(self): pass def test_tester(self): self.selenium.open('/') print no unittest.main() TypeError: '__init__() takes no arguments (2 given)' -- messages: 113802 nosy: antlong priority: normal severity: normal status: open title: __init__ TypeError reverses expected vs received args versions: Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9590 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9590] __init__ TypeError reverses expected vs received args
Florent Xicluna florent.xicl...@gmail.com added the comment: Definitely it does not look like a bug. import unittest help(unittest.TestCase) ... | If it is necessary to override the __init__ method, the base class | __init__ method must always be called. It is important that subclasses | should not change the signature of their __init__ method, since instances | of the classes are instantiated automatically by parts of the framework | in order to be run. ... -- nosy: +flox resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9590 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9590] __init__ TypeError reverses expected vs received args
Mark Dickinson dicki...@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 rep...@bugs.python.org http://bugs.python.org/issue9590 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com