summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descrtut.py
Commit message (Collapse)AuthorAgeFilesLines
* Guido grants a Christmas wish:Raymond Hettinger2003-12-171-2/+1
| | | | sorted() becomes a regular function instead of a classmethod.
* Update test to handle list.__reversed__().Raymond Hettinger2003-11-081-0/+1
|
* Update test to include "sorted" in dir(list).Raymond Hettinger2003-10-291-1/+2
|
* Introducing __reduce_ex__, which is called with a protocol number argumentGuido van Rossum2003-02-181-0/+1
| | | | | if it exists in preference over __reduce__. Now Tim can go implement this in cPickle.c.
* One doctest displaying a dict didn't sort it first. *Maybe* this fixesTim Peters2003-02-181-2/+2
| | | | the AIX problem with this test.
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-3/+3
| | | | | | | | | | | 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. :)
* SF 560736. Optimize list iteration by filling the tp_iter slot.Raymond Hettinger2002-05-311-0/+1
|
* Add the 'bool' type and its values 'False' and 'True', as described inGuido van Rossum2002-04-031-6/+6
| | | | | | | | | | | | | PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates.
* Somebody made list.__dict__ grow a '__doc__' key, but apparently didn'tTim Peters2002-02-191-0/+1
| | | | | run the test suite afterwards. Either that, or whether '__doc__' shows up is platform-dependent!
* Rename "dictionary" (type and constructor) to "dict".Tim Peters2001-10-291-10/+10
|
* Halfway checkin. This is still messy, but it's beginning to addressGuido van Rossum2001-10-091-0/+1
| | | | | | | | | | the problem that slots weren't inherited properly. override_slots() no longer exists; in its place comes fixup_slot_dispatchers() which does more and different work and is table-based. (Eventually I want this table also to replace all the little tab_foo tables.) Also add a wrapper for __delslice__; this required a change in test_descrtut.py.
* - Provisional support for pickling new-style objects. (*)Guido van Rossum2001-09-251-0/+1
| | | | | | | | | | | | | | | | | | | - Made cls.__module__ writable. - Ensure that obj.__dict__ is returned as {}, not None, even upon first reference; it simply springs into life when you ask for it. (*) The pickling support is provisional for the following reasons: - It doesn't support classes with __slots__. - It relies on additional support in copy_reg.py: the C method __reduce__, defined in the object class, really calls calling copy_reg._reduce(obj). Eventually the Python code in copy_reg.py needs to be migrated to C, but I'd like to experiment with the Python implementation first. The _reduce() code also relies on an additional helper function, _reconstructor(), defined in copy_reg.py; this should also be reimplemented in C.
* Change repr() of a new-style class to say <class 'ClassName'> ratherGuido van Rossum2001-09-251-3/+3
| | | | | | than <type 'ClassName'>. Exception: if it's a built-in type or an extension type, continue to call it <type 'ClassName>. Call me a wimp, but I don't want to break more user code than necessary.
* Change the name of the __getattr__ special method for new-styleGuido van Rossum2001-09-211-1/+1
| | | | | | | | classes to __getattribute__, to make it crystal-clear that it doesn't have the same semantics as overriding __getattr__ on classic classes. This is a halfway checkin -- I'll proceed to add a __getattr__ hook that works the way it works in classic classes.
* Teach regrtest how to pass on doctest failure msgs. This is done via aTim Peters2001-09-091-4/+9
| | | | | | | | | | | horridly inefficient hack in regrtest's Compare class, but it's about as clean as can be: regrtest has to set up the Compare instance before importing a test module, and by the time the module *is* imported it's too late to change that decision. The good news is that the more tests we convert to unittest and doctest, the less the inefficiency here matters. Even now there are few tests with large expected-output files (the new cost here is a Python-level call per .write() when there's an expected- output file).
* Force "test." into the start of the module name, inherited by class andTim Peters2001-09-091-17/+11
| | | | type reprs, to accomodate the way Jack runs tests on the Mac.
* Rename 'getset' to 'property'.Guido van Rossum2001-09-061-7/+7
|
* Make dir() wordier (see the new docstring). The new behavior is a mixedTim Peters2001-09-031-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | bag. It's clearly wrong for classic classes, at heart because a classic class doesn't have a __class__ attribute, and I'm unclear on whether that's feature or bug. I'll repair this once I find out (in the meantime, dir() applied to classic classes won't find the base classes, while dir() applied to a classic-class instance *will* find the base classes but not *their* base classes). Please give the new dir() a try and see whether you love it or hate it. The new dir([]) behavior is something I could come to love. Here's something to hate: >>> class C: ... pass ... >>> c = C() >>> dir(c) ['__doc__', '__module__'] >>> The idea that an instance has a __doc__ attribute is jarring (of course it's really c.__class__.__doc__ == C.__doc__; likewise for __module__). OTOH, the code already has too many special cases, and dir(x) doesn't have a compelling or clear purpose when x isn't a module.
* Made a doctest out of the examples in Guido's type/class tutorial.Tim Peters2001-09-031-0/+498