mirror of
https://github.com/python/cpython.git
synced 2025-08-08 02:48:55 +00:00
unittest: issue 8301. Adding functions to test suites no longer crashes.
This commit is contained in:
parent
7daf0e4aa1
commit
9c164af6c3
2 changed files with 15 additions and 1 deletions
|
@ -290,6 +290,15 @@ class Test_TestSuite(unittest.TestCase, TestEquality):
|
|||
suite = unittest.TestSuite()
|
||||
self.assertRaises(TypeError, suite.addTests, "foo")
|
||||
|
||||
def test_function_in_suite(self):
|
||||
def f(_):
|
||||
pass
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTest(f)
|
||||
|
||||
# when the bug is fixed this line will not crash
|
||||
suite.run(unittest.TestResult())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue