mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
convert old fail* assertions to assert*
This commit is contained in:
parent
98d23f2e06
commit
c9c0f201fe
275 changed files with 4540 additions and 4540 deletions
|
@ -130,14 +130,14 @@ class TestBisect(unittest.TestCase):
|
|||
elem = randrange(-1, n+1)
|
||||
ip = self.module.bisect_left(data, elem)
|
||||
if ip < len(data):
|
||||
self.failUnless(elem <= data[ip])
|
||||
self.assertTrue(elem <= data[ip])
|
||||
if ip > 0:
|
||||
self.failUnless(data[ip-1] < elem)
|
||||
self.assertTrue(data[ip-1] < elem)
|
||||
ip = self.module.bisect_right(data, elem)
|
||||
if ip < len(data):
|
||||
self.failUnless(elem < data[ip])
|
||||
self.assertTrue(elem < data[ip])
|
||||
if ip > 0:
|
||||
self.failUnless(data[ip-1] <= elem)
|
||||
self.assertTrue(data[ip-1] <= elem)
|
||||
|
||||
def test_optionalSlicing(self):
|
||||
for func, data, elem, expected in self.precomputedCases:
|
||||
|
@ -146,15 +146,15 @@ class TestBisect(unittest.TestCase):
|
|||
for hi in range(3,8):
|
||||
hi = min(len(data), hi)
|
||||
ip = func(data, elem, lo, hi)
|
||||
self.failUnless(lo <= ip <= hi)
|
||||
self.assertTrue(lo <= ip <= hi)
|
||||
if func is self.module.bisect_left and ip < hi:
|
||||
self.failUnless(elem <= data[ip])
|
||||
self.assertTrue(elem <= data[ip])
|
||||
if func is self.module.bisect_left and ip > lo:
|
||||
self.failUnless(data[ip-1] < elem)
|
||||
self.assertTrue(data[ip-1] < elem)
|
||||
if func is self.module.bisect_right and ip < hi:
|
||||
self.failUnless(elem < data[ip])
|
||||
self.assertTrue(elem < data[ip])
|
||||
if func is self.module.bisect_right and ip > lo:
|
||||
self.failUnless(data[ip-1] <= elem)
|
||||
self.assertTrue(data[ip-1] <= elem)
|
||||
self.assertEqual(ip, max(lo, min(hi, expected)))
|
||||
|
||||
def test_backcompatibility(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue