diff options
author | Raymond Hettinger <python@rcn.com> | 2004-06-15 23:53:35 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-06-15 23:53:35 (GMT) |
commit | aefde435efb8e99c74ad147e1a1db76fe5de61aa (patch) | |
tree | d32a79e48b1b6df8c6c4a5b84ba79902220bda9a /Lib/test/test_heapq.py | |
parent | 969297f488f314833e8ed591123deff7bd154cbd (diff) | |
download | cpython-aefde435efb8e99c74ad147e1a1db76fe5de61aa.zip cpython-aefde435efb8e99c74ad147e1a1db76fe5de61aa.tar.gz cpython-aefde435efb8e99c74ad147e1a1db76fe5de61aa.tar.bz2 |
Reverse argument order for nsmallest() and nlargest().
Reads better when the iterable is a generator expression.
Diffstat (limited to 'Lib/test/test_heapq.py')
-rw-r--r-- | Lib/test/test_heapq.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py index b6fec9f..4e535e9 100644 --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -92,13 +92,13 @@ class TestHeap(unittest.TestCase): def test_nsmallest(self): data = [random.randrange(2000) for i in range(1000)] - for i in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): - self.assertEqual(nsmallest(data, i), sorted(data)[:i]) + for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): + self.assertEqual(nsmallest(n, data), sorted(data)[:n]) def test_largest(self): data = [random.randrange(2000) for i in range(1000)] - for i in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): - self.assertEqual(nlargest(data, i), sorted(data, reverse=True)[:i]) + for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): + self.assertEqual(nlargest(n, data), sorted(data, reverse=True)[:n]) def test_main(verbose=None): test_classes = [TestHeap] |