diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-05-08 17:06:25 (GMT) |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-05-08 17:06:25 (GMT) |
commit | 9c164af6c35cc0a0b21162d74bd7ea572731ed2c (patch) | |
tree | 6ce4a91fc6328b49b45151eca1fbbedd404dfc4d /Lib/unittest/test | |
parent | 7daf0e4aa13b98d5217dc49e5f87e7a4007aee33 (diff) | |
download | cpython-9c164af6c35cc0a0b21162d74bd7ea572731ed2c.zip cpython-9c164af6c35cc0a0b21162d74bd7ea572731ed2c.tar.gz cpython-9c164af6c35cc0a0b21162d74bd7ea572731ed2c.tar.bz2 |
unittest: issue 8301. Adding functions to test suites no longer crashes.
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r-- | Lib/unittest/test/test_suite.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_suite.py b/Lib/unittest/test/test_suite.py index 7cd2b89..2b8d678 100644 --- a/Lib/unittest/test/test_suite.py +++ b/Lib/unittest/test/test_suite.py @@ -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() |