Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(261812)

Unified Diff: Lib/test/test_bisect.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_binop.py ('k') | Lib/test/test_buffer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_bisect.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_bisect.py Fri Feb 07 23:40:05 2014 +0200
@@ -159,14 +159,14 @@
elem = randrange(-1, n+1)
ip = self.module.bisect_left(data, elem)
if ip < len(data):
- self.assertTrue(elem <= data[ip])
+ self.assertLessEqual(elem, data[ip])
if ip > 0:
- self.assertTrue(data[ip-1] < elem)
+ self.assertLess(data[ip-1], elem)
ip = self.module.bisect_right(data, elem)
if ip < len(data):
- self.assertTrue(elem < data[ip])
+ self.assertLess(elem, data[ip])
if ip > 0:
- self.assertTrue(data[ip-1] <= elem)
+ self.assertLessEqual(data[ip-1], elem)
def test_optionalSlicing(self):
for func, data, elem, expected in self.precomputedCases:
@@ -177,13 +177,13 @@
ip = func(data, elem, lo, hi)
self.assertTrue(lo <= ip <= hi)
if func is self.module.bisect_left and ip < hi:
- self.assertTrue(elem <= data[ip])
+ self.assertLessEqual(elem, data[ip])
if func is self.module.bisect_left and ip > lo:
- self.assertTrue(data[ip-1] < elem)
+ self.assertLess(data[ip-1], elem)
if func is self.module.bisect_right and ip < hi:
- self.assertTrue(elem < data[ip])
+ self.assertLess(elem, data[ip])
if func is self.module.bisect_right and ip > lo:
- self.assertTrue(data[ip-1] <= elem)
+ self.assertLessEqual(data[ip-1], elem)
self.assertEqual(ip, max(lo, min(hi, expected)))
def test_backcompatibility(self):
« no previous file with comments | « Lib/test/test_binop.py ('k') | Lib/test/test_buffer.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+