mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
This commit is contained in:
parent
9decc0dc8b
commit
d9e50261e8
2 changed files with 22 additions and 0 deletions
|
@ -1580,6 +1580,19 @@ class Test_TestSuite(TestCase, TestEquality):
|
|||
pass
|
||||
else:
|
||||
self.fail("Failed to raise TypeError")
|
||||
|
||||
def test_addTest__noncallable(self):
|
||||
suite = unittest.TestSuite()
|
||||
self.assertRaises(TypeError, suite.addTest, 5)
|
||||
|
||||
def test_addTest__casesuiteclass(self):
|
||||
suite = unittest.TestSuite()
|
||||
self.assertRaises(TypeError, suite.addTest, Test_TestSuite)
|
||||
self.assertRaises(TypeError, suite.addTest, unittest.TestSuite)
|
||||
|
||||
def test_addTests__string(self):
|
||||
suite = unittest.TestSuite()
|
||||
self.assertRaises(TypeError, suite.addTests, "foo")
|
||||
|
||||
|
||||
class Test_FunctionTestCase(TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue