Nick Coghlan
5533ff6a2e
Issue 5354: Change API for import_fresh_module() to better support test_warnings use case (also fixes some bugs in the original implementation)
2009-04-22 15:26:04 +00:00
Nick Coghlan
cd2e7042ae
Issue 5354: Provide a standardised testing mechanism for doing fresh imports of modules, including the ability to block extension modules in order to test the pure Python fallbacks
2009-04-11 13:31:31 +00:00
Neal Norwitz
04097a6282
Fix typo in method name. The LT class implemented less than. The LE class
...
should implement less than or equal to (as the code does).
2008-06-13 06:03:25 +00:00
Raymond Hettinger
e29a10306c
Add test for heapq using both __lt__ and __le__.
2008-06-11 13:14:50 +00:00
Raymond Hettinger
53bdf09343
Issue 2274: Add heapq.heappushpop().
2008-03-13 19:03:51 +00:00
Georg Brandl
0bb8567e1e
In test_heapq and test_bisect, test both the Python and the C implementation.
...
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
2008-02-23 22:35:33 +00:00
Raymond Hettinger
01b9881062
Add test for merge stability
2007-02-19 07:30:21 +00:00
Raymond Hettinger
00166c5532
Add merge() function to heapq.
2007-02-19 04:08:43 +00:00
Raymond Hettinger
769a40a1d0
Fix stability of heapq's nlargest() and nsmallest().
2007-01-04 17:53:34 +00:00
Raymond Hettinger
4901a1f267
Add key= argument to heapq.nsmallest() and heapq.nlargest().
2004-12-02 08:59:14 +00:00
Raymond Hettinger
e1defa4175
Fix argument order in pure python version of nsmallest() and nlargest().
2004-11-29 05:54:48 +00:00
Raymond Hettinger
855d9a985b
Plug a leak and beef-up test coverage.
2004-09-28 00:03:54 +00:00
Tim Peters
27f883687b
Whitespace normalization.
2004-07-08 04:22:35 +00:00
Neal Norwitz
d7be118626
Exercise some error conditions
2004-07-08 01:56:46 +00:00
Raymond Hettinger
aefde435ef
Reverse argument order for nsmallest() and nlargest().
...
Reads better when the iterable is a generator expression.
2004-06-15 23:53:35 +00:00
Raymond Hettinger
2e3dfaf707
Install C version of heapq.nsmallest().
2004-06-13 05:26:33 +00:00
Raymond Hettinger
b25aa36f83
Improve the memory performance and speed of heapq.nsmallest() by using
...
an alternate algorithm when the number of selected items is small
relative to the full iterable.
2004-06-12 08:33:36 +00:00
Raymond Hettinger
bce036b49e
Convert test_heapq.py to unittests.
2004-06-10 05:07:18 +00:00
Raymond Hettinger
33ecffb65a
SF patch #969791 : Add nlargest() and nsmallest() to heapq.
2004-06-10 05:03:17 +00:00
Raymond Hettinger
065c06a622
Add another test which exercises the whole suite with a
...
heapsort and verifies the result against list.sort().
2002-12-07 10:33:42 +00:00
Tim Peters
0cd53a6c37
Added new heapreplace(heap, item) function, to pop (and return) the
...
currently-smallest value, and add item, in one gulp. See the second
N-Best algorithm in the test suite for a natural use.
2002-08-03 10:10:10 +00:00
Tim Peters
aa7d24319e
Minor fiddling, including a simple class to implement a heap iterator
...
in the test file. I have docs for heapq.heapify ready to check in, but
Jack appears to have left behind a stale lock in the Doc/lib directory.
2002-08-03 02:11:26 +00:00
Tim Peters
28c25527c2
Hmm! I thought I checked this in before! Oh well.
...
Added new heapify() function, which transforms an arbitrary list into a
heap in linear time; that's a fundamental tool for using heaps in real
life <wink>.
Added heapyify() test. Added a "less naive" N-best algorithm to the test
suite, and noted that this could actually go much faster (building on
heapify()) if we had max-heaps instead of min-heaps (the iterative method
is appropriate when all the data isn't known in advance, but when it is
known in advance the tradeoffs get murkier).
2002-08-02 21:48:06 +00:00
Tim Peters
d2cf1ab0e2
check_invariant(): Use the same child->parent "formula" used by heapq.py.
2002-08-02 19:41:54 +00:00
Tim Peters
d9ea39db84
Don't use true division where int division was intended. For that matter,
...
don't use division at all.
2002-08-02 19:16:44 +00:00
Guido van Rossum
0b19178736
Adding the heap queue algorithm, per discussion in python-dev last
...
week.
2002-08-02 18:29:53 +00:00