summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_deque.py
Commit message (Collapse)AuthorAgeFilesLines
* Add tests for tuple, list and UserList that initialize the object fromWalter Dörwald2005-03-221-83/+7
| | | | | | various iterables. (Copied from test_deque.py as suggested by Jim Jewett in SF bug #1166274)
* Fix typo.Walter Dörwald2005-03-221-1/+1
|
* Apply remove's mutation test after every equality test.Raymond Hettinger2005-03-191-7/+8
|
* Add a remove() method to collections.deque objects.Raymond Hettinger2005-03-181-0/+35
|
* SF patch #1062279: deque pickling problemsRaymond Hettinger2004-11-091-4/+36
| | | | | | | (Contributed by Dima Dorfman.) * Support pickling of dictionaries in instances of deque subclasses. * Support pickling of recursive deques.
* Upon insertion, if memory runs out, the deque was left in a corrupted state.Armin Rigo2004-10-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | deque_item(): a performance bug: the linked list of blocks was followed from the left in most cases, because the test (i < (deque->len >> 1)) was after "i %= BLOCKLEN". deque_clear(): replaced a call to deque_len() with deque->len; not sure what this call was here for, nor if all compilers under the sun would inline it. deque_traverse(): I belive that it could be called by the GC when the deque has leftblock==rightblock==NULL, because it is tracked before the first block is allocated (though closely before). Still, a C extension module subclassing deque could provide its own tp_alloc that could trigger a GC collection after the PyObject_GC_Track()... deque_richcompare(): rewrote to cleanly check for end-of-iterations instead of relying on deque.__iter__().next() to succeed exactly len(deque) times -- an assumption which can break if deques are subclassed. Added a test. I wonder if the length should be explicitely bounded to INT_MAX, with OverflowErrors, as in listobject.c. On 64-bit machines, adding more than INT_MAX in the deque will result in trouble. (Note to anyone/me fixing this: carefully check for overflows if len is close to INT_MAX in the following functions: deque_rotate(), deque_item(), deque_ass_item())
* deque_traverse(): If the deque had one block, and its rightindex wasTim Peters2004-10-011-0/+9
| | | | | BLOCKLEN-1, this assert-failed in a debug build, or went wild with a NULL pointer in a release build. Reported on c.l.py by Stefan Behnel.
* Use floor division operator.Raymond Hettinger2004-09-271-1/+1
|
* Remove unnecessary line.Raymond Hettinger2004-08-261-1/+0
|
* * balance the left/right search for getitem.Raymond Hettinger2004-07-091-4/+31
| | | | | * use assertions instead of tests after internal calls that can't fail. * expand test coverage
* Make sets and deques weak referencable.Raymond Hettinger2004-05-301-0/+7
|
* SF patch #872326: Generator expression implementationRaymond Hettinger2004-05-191-1/+1
| | | | | | | | | | | | | | (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
* Make sure "del d[n]" is properly supported. Was necessary because theRaymond Hettinger2004-05-121-3/+14
| | | | | | same method that implements __setitem__ also implements __delitem__. Also, there were several good use cases (removing items from a queue and implementing Forth style stack ops).
* Temporarily disable doctest until genexps are in CVSRaymond Hettinger2004-05-101-1/+1
|
* Add more examples.Raymond Hettinger2004-05-091-0/+51
|
* Replace left(), right(), and __reversed__() with the more general purposeRaymond Hettinger2004-03-011-9/+34
| | | | | | | __getitem__() and __setitem__(). Simplifies the API, reduces the code size, adds flexibility, and makes deques work with bisect.bisect(), random.shuffle(), and random.sample().
* Improvements to collections.deque():Raymond Hettinger2004-02-291-3/+89
| | | | | | | | * Add doctests for the examples in the library reference. * Add two methods, left() and right(), modeled after deques in C++ STL. * Apply the new method to asynchat.py. * Add comparison operators to make deques more substitutable for lists. * Replace the LookupErrors with IndexErrors to more closely match lists.
* Make deque.rotate() smarter. Beef-up related tests.Raymond Hettinger2004-02-081-9/+43
|
* * Incorporate Skip's suggestions for documentation (explain the word dequeRaymond Hettinger2004-02-071-0/+12
| | | | | comes from and show the differences from lists). * Add a rotate() method.
* * Fix ref counting in extend() and extendleft().Raymond Hettinger2004-02-071-0/+4
| | | | * Let deques support reversed().
* Have deques support high volume loads.Raymond Hettinger2004-02-061-0/+12
|
* * Move collections.deque() in from the sandboxRaymond Hettinger2004-01-291-0/+337
* Add unittests, newsitem, and whatsnew * Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py * Docs are forthcoming