mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fix issue 9926. TestSuite subclasses that override __call__ are called correctly.
This commit is contained in:
parent
e6fa3811f7
commit
bbea35f194
3 changed files with 32 additions and 19 deletions
|
@ -345,5 +345,19 @@ class Test_TestSuite(unittest.TestCase, TestEquality):
|
|||
self.assertEqual(result.testsRun, 2)
|
||||
|
||||
|
||||
def test_overriding_call(self):
|
||||
class MySuite(unittest.TestSuite):
|
||||
called = False
|
||||
def __call__(self, *args, **kw):
|
||||
self.called = True
|
||||
unittest.TestSuite.__call__(self, *args, **kw)
|
||||
|
||||
suite = MySuite()
|
||||
wrapper = unittest.TestSuite()
|
||||
wrapper.addTest(suite)
|
||||
wrapper(unittest.TestResult())
|
||||
self.assertTrue(suite.called)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue