mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
#7031: Add TestCase.assertIsInstance and negated method.
This commit is contained in:
parent
46cc46af07
commit
f895cf5d33
3 changed files with 41 additions and 0 deletions
|
@ -2500,6 +2500,18 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
|
|||
self.assertIsNot(thing, object())
|
||||
self.assertRaises(self.failureException, self.assertIsNot, thing, thing)
|
||||
|
||||
def testAssertIsInstance(self):
|
||||
thing = []
|
||||
self.assertIsInstance(thing, list)
|
||||
self.assertRaises(self.failureException, self.assertIsInstance,
|
||||
thing, dict)
|
||||
|
||||
def testAssertNotIsInstance(self):
|
||||
thing = []
|
||||
self.assertNotIsInstance(thing, dict)
|
||||
self.assertRaises(self.failureException, self.assertNotIsInstance,
|
||||
thing, list)
|
||||
|
||||
def testAssertIn(self):
|
||||
animals = {'monkey': 'banana', 'cow': 'grass', 'seal': 'fish'}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue