summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_userdict.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix most trivially-findable print statements.Guido van Rossum2007-02-091-1/+1
| | | | | | | | | There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
* SF patch 1631942 by Collin Winter:Guido van Rossum2007-01-101-3/+3
| | | | | | (a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
* Remove usage of backticks.Brett Cannon2006-08-251-1/+1
|
* Restructure comparison dramatically. There is no longer a defaultGuido van Rossum2006-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *ordering* between objects; there is only a default equality test (defined by an object being equal to itself only). Read the comment in object.c. The current implementation never uses a three-way comparison to compute a rich comparison, but it does use a rich comparison to compute a three-way comparison. I'm not quite done ripping out all the calls to PyObject_Compare/Cmp, or replacing tp_compare implementations with tp_richcompare implementations; but much of that has happened (to make most unit tests pass). The following tests still fail, because I need help deciding or understanding: test_codeop -- depends on comparing code objects test_datetime -- need Tim Peters' opinion test_marshal -- depends on comparing code objects test_mutants -- need help understanding it The problem with test_codeop and test_marshal is this: these tests compare two different code objects and expect them to be equal. Is that still a feature we'd like to support? I've temporarily removed the comparison and hash code from code objects, so they use the default (equality by pointer only) comparison. For the other two tests, run them to see for yourself. (There may be more failing test with "-u all".) A general problem with getting lots of these tests to pass is the reality that for object types that have a natural total ordering, implementing __cmp__ is much more convenient than implementing __eq__, __ne__, __lt__, and so on. Should we go back to allowing __cmp__ to provide a total ordering? Should we provide some other way to implement rich comparison with a single method override? Alex proposed a __key__() method; I've considered a __richcmp__() method. Or perhaps __cmp__() just shouldn't be killed off...
* Get rid of dict.has_key(). Boy this has a lot of repercussions!Guido van Rossum2006-08-181-8/+2
| | | | | | Not all code has been fixed yet; this is just a checkpoint... The C API still has PyDict_HasKey() and _HasKeyString(); not sure if I want to change those just yet.
* - Patch 1433928:Guido van Rossum2006-02-251-0/+49
| | | | | | | | - The copy module now "copies" function objects (as atomic objects). - dict.__getitem__ now looks for a __missing__ hook before raising KeyError. - Added a new type, defaultdict, to the collections module. This uses the new __missing__ hook behavior added to dict (see above).
* Use descriptors.Guido van Rossum2005-01-161-1/+1
|
* Rename class attribute containing the class to be tested, so the name is theWalter Dörwald2004-06-021-2/+2
| | | | same as for the string and sequence tests.
* Port the dictionary tests from test_types.py to unittest. Collect as muchWalter Dörwald2004-05-311-125/+23
| | | | | | mapping tests as possible in mapping_test.py and reuse the tests in test_dict.py, test_userdict.py, test_weakref.py, test_os.py and test_shelve.py. From SF patch #736962.
* SF #904720: dict.update should take a 2-tuple sequence like dict.__init_Raymond Hettinger2004-03-041-1/+5
| | | | | | | | (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments.
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-4/+2
| | | | | | | | * Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.
* Used sets.Set() to compare unordered sequences.Raymond Hettinger2003-05-021-7/+3
| | | | Improves clarity and brevity.
* Combine the functionality of test_support.run_unittest()Walter Dörwald2003-05-011-5/+5
| | | | | | | | | | and test_support.run_classtests() into run_unittest() and use it wherever possible. Also don't use "from test.test_support import ...", but "from test import test_support" in a few spots. From SF patch #662807.
* SF patch #667730: More DictMixinRaymond Hettinger2003-03-091-2/+124
| | | | | | | | * Adds missing pop() methods to weakref.py * Expands test suite to broaden coverage of objects with a mapping interface. Contributed by Sebastien Keim.
* SF patch #693753: fix for bug 639806: default for dict.popRaymond Hettinger2003-03-061-0/+6
| | | | (contributed by Michael Stone.)
* Port test_userdict.py to PyUnit. From SF patch #662807,Walter Dörwald2003-01-191-193/+233
| | | | with additional tests for setdefault(), pop() and popitem().
* Clean-up test class for DictMixin.Raymond Hettinger2002-12-111-2/+6
|
* Bring UserDict in-sync with changes to dict.Raymond Hettinger2002-11-271-0/+13
| | | | | | Constructor accepts optional keyword arguments after a optional items list. Add fromkeys() as an alternate constructor from an iterable over keys. Expand related unittests.
* Implement dict() style constructor.Raymond Hettinger2002-11-221-0/+3
| | | | | | | | | | | Already supported dict() and dict(mapping). Now supports dict(itemsequence) and Just van Rossum's new syntax for dict(keywordargs). Also, added related unittests. The docs already promise dict-like behavior so no update is needed there.
* Improve DictMixin.Raymond Hettinger2002-11-181-6/+5
| | | | | | | | | | | Replaced docstring with comments. Prevents subclass contamination. Added the missing __cmp__() method and a test for __cmp__(). Used try/except style in preference to has_key() followed by a look-up. Used iteritem() where possible to save creating a long key list and to save redundant lookups. Expanded .update() to look for the most helpful methods first and gradually work down to a mininum expected interface. Expanded documentation to be more clear on how to use the class.
* SF patch #520382: Expand shelve.py to have a full dictionary interfaceRaymond Hettinger2002-11-151-0/+98
| | | | | and add a mixin to UserDict.py to make it easier to implement a full dictionary interface.
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Add regression test for SF bug #476616 -- make sure copy of a derived classFred Drake2001-11-051-0/+4
| | | | does not share data with the original.
* Fix the test so it uses IterableUserDict for the "for x in dict" test.Guido van Rossum2001-08-071-2/+2
|
* Give UserDict new __contains__ and __iter__ methods.Tim Peters2001-04-211-1/+15
|
* This patch removes all uses of "assert" in the regression test suiteMarc-André Lemburg2001-01-171-20/+21
| | | | | | | and replaces them with a new API verify(). As a result the regression suite will also perform its tests in optimization mode. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Test suite for UserDictGuido van Rossum1999-03-261-0/+101