mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Merged revisions 77727 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77727 | ezio.melotti | 2010-01-24 18:58:36 +0200 (Sun, 24 Jan 2010) | 1 line use assert[Not]IsInstance where appropriate ........
This commit is contained in:
parent
f41d29a8eb
commit
e96159335f
52 changed files with 287 additions and 288 deletions
|
@ -435,15 +435,13 @@ class TestMappingProtocol(BasicTestMappingProtocol):
|
|||
self.assertEqual(dictlike().fromkeys('a'), {'a':None})
|
||||
self.assertTrue(dictlike.fromkeys('a').__class__ is dictlike)
|
||||
self.assertTrue(dictlike().fromkeys('a').__class__ is dictlike)
|
||||
# FIXME: the following won't work with UserDict, because it's an old style class
|
||||
# self.assertTrue(type(dictlike.fromkeys('a')) is dictlike)
|
||||
self.assertTrue(type(dictlike.fromkeys('a')) is dictlike)
|
||||
class mydict(self.type2test):
|
||||
def __new__(cls):
|
||||
return collections.UserDict()
|
||||
ud = mydict.fromkeys('ab')
|
||||
self.assertEqual(ud, {'a':None, 'b':None})
|
||||
# FIXME: the following won't work with UserDict, because it's an old style class
|
||||
# self.assertTrue(isinstance(ud, collections.UserDict))
|
||||
self.assertIsInstance(ud, collections.UserDict)
|
||||
self.assertRaises(TypeError, dict.fromkeys)
|
||||
|
||||
class Exc(Exception): pass
|
||||
|
@ -473,7 +471,7 @@ class TestMappingProtocol(BasicTestMappingProtocol):
|
|||
self.assertEqual(d.copy(), {1:1, 2:2, 3:3})
|
||||
d = self._empty_mapping()
|
||||
self.assertEqual(d.copy(), d)
|
||||
self.assertTrue(isinstance(d.copy(), d.__class__))
|
||||
self.assertIsInstance(d.copy(), d.__class__)
|
||||
self.assertRaises(TypeError, d.copy, None)
|
||||
|
||||
def test_get(self):
|
||||
|
@ -571,7 +569,7 @@ class TestHashMappingProtocol(TestMappingProtocol):
|
|||
return collections.UserDict()
|
||||
ud = mydict.fromkeys('ab')
|
||||
self.assertEqual(ud, {'a':None, 'b':None})
|
||||
self.assertTrue(isinstance(ud, collections.UserDict))
|
||||
self.assertIsInstance(ud, collections.UserDict)
|
||||
|
||||
def test_pop(self):
|
||||
TestMappingProtocol.test_pop(self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue