mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
use assert[Not]IsInstance where appropriate
This commit is contained in:
parent
f14c7fc33d
commit
b0f5adc3f4
57 changed files with 269 additions and 272 deletions
|
|
@ -76,15 +76,15 @@ class IntTestCases(unittest.TestCase):
|
|||
s = repr(-1-sys.maxint)
|
||||
x = int(s)
|
||||
self.assertEqual(x+1, -sys.maxint)
|
||||
self.assertTrue(isinstance(x, int))
|
||||
self.assertIsInstance(x, int)
|
||||
# should return long
|
||||
self.assertEqual(int(s[1:]), sys.maxint+1)
|
||||
|
||||
# should return long
|
||||
x = int(1e100)
|
||||
self.assertTrue(isinstance(x, long))
|
||||
self.assertIsInstance(x, long)
|
||||
x = int(-1e100)
|
||||
self.assertTrue(isinstance(x, long))
|
||||
self.assertIsInstance(x, long)
|
||||
|
||||
|
||||
# SF bug 434186: 0x80000000/2 != 0x80000000>>1.
|
||||
|
|
@ -102,11 +102,11 @@ class IntTestCases(unittest.TestCase):
|
|||
self.assertRaises(ValueError, int, '123\x00 245', 20)
|
||||
|
||||
x = int('1' * 600)
|
||||
self.assertTrue(isinstance(x, long))
|
||||
self.assertIsInstance(x, long)
|
||||
|
||||
if have_unicode:
|
||||
x = int(unichr(0x661) * 600)
|
||||
self.assertTrue(isinstance(x, long))
|
||||
self.assertIsInstance(x, long)
|
||||
|
||||
self.assertRaises(TypeError, int, 1, 12)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue