summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* Added tests for MIMEAudio class/moduleBarry Warsaw2001-10-091-4/+69
|
* Add a test for get_all() returning failobj. msg_20.txt is a sampleBarry Warsaw2001-10-092-0/+28
| | | | message with multiple CC: fields, used in the get_all() test.
* It turned out not so difficult to support old-style numbers (thoseGuido van Rossum2001-10-091-5/+6
| | | | | | | without the Py_TPFLAGS_CHECKTYPES flag) in the wrappers. This required a few changes in test_descr.py to cope with the fact that the complex type has __int__, __long__ and __float__ methods that always raise an exception.
* Added tests that check getboolean() with the newly allowed values fromFred Drake2001-10-082-0/+38
| | | | SF patch #467580.
* Change all occurrences of verify(x == y) into vereq(x, y), since whenGuido van Rossum2001-10-081-374/+376
| | | | | | | | this type of test fails, vereq() does a better job of reporting than verify(). Change vereq(x, y) to use "not x == y" rather than "x != y" -- it makes a difference is some overloading tests.
* Enable GC for new-style instances. This touches lots of files, sinceGuido van Rossum2001-10-051-0/+19
| | | | | | | | | | | | | | | | | | | | | | many types were subclassable but had a xxx_dealloc function that called PyObject_DEL(self) directly instead of deferring to self->ob_type->tp_free(self). It is permissible to set tp_free in the type object directly to _PyObject_Del, for non-GC types, or to _PyObject_GC_Del, for GC types. Still, PyObject_DEL was a tad faster, so I'm fearing that our pystone rating is going down again. I'm not sure if doing something like void xxx_dealloc(PyObject *self) { if (PyXxxCheckExact(self)) PyObject_DEL(self); else self->ob_type->tp_free(self); } is any faster than always calling the else branch, so I haven't attempted that -- however those types whose own dealloc is fancier (int, float, unicode) do use this pattern.
* Non-failing test for SF bug #467059.Fred Drake2001-10-041-0/+42
|
* run_suite(): If testclass is not available, provide an even more generalFred Drake2001-10-041-4/+8
| | | | | | | error message. run_unittest(): Provide the testclass to run_suite() so it can construct the error message. This closes SF bug #467763.
* TestIterators: Tim Peters suggests a more succinct spelling ofBarry Warsaw2001-10-041-12/+4
| | | | "listify an iterator".
* More test data for test_email.pyBarry Warsaw2001-10-042-0/+49
|
* test_header_splitter(), test_body_line_iterator(): Move the test dataBarry Warsaw2001-10-041-70/+32
| | | | into tests/data/msg_*.txt files.
* Updated to reflect the rationalized profiler event reporting.Fred Drake2001-10-041-46/+27
|
* This test relied on hard tab characters, so failed after whitespaceTim Peters2001-10-041-5/+5
| | | | normalization. Now uses \t in strings instead of hard tabs.
* class_docstrings(): The new-style class tests should use new-styleTim Peters2001-10-041-4/+4
| | | | classes (sheesh!).
* Whitespace normalization.Tim Peters2001-10-044-36/+36
|
* SF bug [#467331] ClassType.__doc__ always None.Tim Peters2001-10-042-6/+35
| | | | | | | | | For a dynamically constructed type object, fill in the tp_doc slot with a copy of the argument dict's "__doc__" value, provided the latter exists and is a string. NOTE: I don't know what to do if it's a Unicode string, so in that case tp_doc is left NULL (which shows up as Py_None if you do Class.__doc__). Note that tp_doc holds a char*, not a general PyObject*.
* Hopefully fix the profiler right. Add a test suite that checks thatGuido van Rossum2001-10-042-0/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it deals correctly with some anomalous cases; according to this test suite I've fixed it right. The anomalous cases had to do with 'exception' events: these aren't generated when they would be most helpful, and the profiler has to work hard to recover the right information. The problems occur when C code (such as hasattr(), which is used as the example here) calls back into Python code and clears an exception raised by that Python code. Consider this example: def foo(): hasattr(obj, "bar") Where obj is an instance from a class like this: class C: def __getattr__(self, name): raise AttributeError The profiler sees the following sequence of events: call (foo) call (__getattr__) exception (in __getattr__) return (from foo) Previously, the profiler would assume the return event returned from __getattr__. An if statement checking for this condition and raising an exception was commented out... This version does the right thing.
* Add some more test cases to be sure we do the right thing in various cases.Fred Drake2001-10-031-0/+117
|
* dynamics(): add a dummy __getattr__ method to the C class so that theGuido van Rossum2001-10-031-0/+5
| | | | | | test for modifying __getattr__ works, now that slot_tp_getattr_hook zaps the slot if there's no hook. Added an XXX comment with a ref back to slot_tp_getattr_hook.
* Made the classmethod docstring test a bit less trivial.Tim Peters2001-10-031-3/+3
|
* SF bug [#467336] doctest failures w/ new-style classes.Tim Peters2001-10-033-2/+118
| | | | | | | | | | Taught doctest about static methods, class methods, and property docstrings in new-style classes. As for inspect.py/pydoc.py before it, the new stuff needed didn't really fit into the old architecture (but was less of a strain to force-fit here). New-style class docstrings still aren't found, but that's the subject of a different bug and I want to fix that right instead of hacking around it in doctest.
* Add Garbage Collection support to new-style classes (not yet to theirGuido van Rossum2001-10-021-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | instances). Also added GC support to various auxiliary types: super, property, descriptors, wrappers, dictproxy. (Only type objects have a tp_clear field; the other types are.) One change was necessary to the GC infrastructure. We have statically allocated type objects that don't have a GC header (and can't easily be given one) and heap-allocated type objects that do have a GC header. Giving these different metatypes would be really ugly: I tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new invent a new name for the new metatype and make it a built-in, change affected tests... In short, a mess. So instead, we add a new type slot tp_is_gc, which is a simple Boolean function that determines whether a particular instance has GC headers or not. This slot is only relevant for types that have the (new) GC flag bit set. If the tp_is_gc slot is NULL (by far the most common case), all instances of the type are deemed to have GC headers. This slot is called by the PyObject_IS_GC() macro (which is only used twice, both times in gcmodule.c). I also changed the extern declarations for a bunch of GC-related functions (_PyObject_GC_Del etc.): these always exist but objimpl.h only declared them when WITH_CYCLE_GC was defined, but I needed to be able to reference them without #ifdefs. (When WITH_CYCLE_GC is not defined, they do the same as their non-GC counterparts anyway.)
* pickles():Guido van Rossum2001-10-021-18/+22
| | | | | | | | - The test for deepcopy() in pickles() was indented wrongly, so it got run twice (one for binary pickle mode, one for text pickle mode; but the test doesn't depend on the pickle mode). - In verbose mode, show which subtest (pickle/cPickle/deepcopy, text/bin).
* The error reporting here was a bit sparse. In verbose mode, the codeGuido van Rossum2001-10-021-30/+24
| | | | | | | | | | in run_test() referenced two non-existent variables, and in non-verbose mode, the tests didn't report the actual number, when it differed from the expected number. Fixed this. Also added an extra call to gc.collect() at the start of test_all(). This will be needed when I check in the changes to add GC to new-style classes.
* SF patch [#466616] Exclude imported items from doctest,Tim Peters2001-10-021-2/+3
| | | | | | | from Tim Hochberg. Also mucho fiddling to change the way doctest determines whether a thing is a function, module or class. Under 2.2, this really requires the functions in inspect.py (e.g., types.ClassType is close to meaningless now, if not outright misleading).
* simple dumps/loads test case for xmlrpclibSkip Montanaro2001-10-011-0/+23
|
* Patch #462190, patch #464070: Support quoted printable in the binascii module.Martin v. Löwis2001-09-301-0/+13
| | | | Decode and encode underscores for header style encoding. Fixes bug #463996.
* Add a few ``__dynamic__ = 0'' lines in classes that need to preserveGuido van Rossum2001-09-291-3/+7
| | | | | | | | | | | | staticness when __dynamic__ = 1 becomes the default: - Some classes which are used to test the difference between static and dynamic. - Subclasses of complex: complex uses old-style numbers and the slot wrappers used by dynamic classes only support new-style numbers. (Ideally, the complex type should be fixed, but that looks like a labor-intensive job.)
* It's a fact: for binary operators, *under certain circumstances*,Guido van Rossum2001-09-281-1/+36
| | | | | | | | | | | | | __rop__ now takes precendence over __op__. Those circumstances are: - Both arguments are new-style classes - Both arguments are new-style numbers - Their implementation slots for tp_op differ - Their types differ - The right argument's type is a subtype of the left argument's type Also did this for the ternary operator (pow) -- only the binary case is dealt with properly though, since __rpow__ is not supported anyway.
* Update the xml.dom.minidom tests to cover the DOM-compliant parts of theFred Drake2001-09-282-2/+31
| | | | NodeList interface.
* Remove an infelicitous space.Fred Drake2001-09-281-1/+1
|
* regrtest's -g option stopped working, during the changes to improveTim Peters2001-09-281-1/+1
| | | | | error-reporting for the classic compare-expected-output tests. Curiously, the bug consisted of not simplifying the logic enough!
* Reflect recent refinements of the regression testing framework.Fred Drake2001-09-281-9/+33
|
* Changes to copy() and deepcopy() in copy.py to support __reduce__ as aGuido van Rossum2001-09-281-1/+43
| | | | | | | | | | fallback for objects that are neither supported by our dispatch table nor have a __copy__ or __deepcopy__ method. Changes to _reduce() in copy_reg.py to support reducing objects that don't have a __dict__ -- copy.copy(complex()) now invokes _reduce(). Add tests for copy.copy() and copy.deepcopy() to test_regrtest.py.
* More test cases, including something that simulates what the profilerFred Drake2001-09-261-5/+66
| | | | probably *should* be doing.
* A file just to look at (using pydoc).Tim Peters2001-09-261-0/+297
|
* Add tests for new PyErr_NormalizeException() behaviorJeremy Hylton2001-09-261-0/+35
| | | | | | | | | | | | Add raise_exception() to the _testcapi module. It isn't a test, but the C API exists only to support test_exceptions. raise_exception() takes two arguments -- an exception class and an integer specifying how many arguments it should be called with. test_exceptions uses BadException() to test the interpreter's behavior when there is a problem instantiating the exception. test_capi1() calls it with too many arguments. test_capi2() causes an exception to be raised in the Python code of the constructor.
* Test case for SF bugs #463359 and #462937, added to test_grammar for lack ofThomas Wouters2001-09-262-0/+28
| | | | | a better place. Excessively fragile code, but at least it breaks when something in this area changes!
* Update the tests for the current incarnation of the email package, andBarry Warsaw2001-09-261-105/+198
| | | | added some new tests of message/delivery-status content type messages.
* More test messages for test_email.pyBarry Warsaw2001-09-262-0/+135
|
* test_iterator(): Don't do a type comparison to see if it's anBarry Warsaw2001-09-251-1/+4
| | | | | | iterator, just test to make sure it has the two required iterator protocol methods __iter__() and next() -- actually just test hasattr-ness.
* Factor out the protect-from-exceptions helpers and make capture_events()Fred Drake2001-09-251-35/+65
| | | | | | use it. This simplifies the individual tests a little. Added some new tests related to exception handling.
* Guido points out that sys.__stdout__ is a bit bucket under IDLE. So keepTim Peters2001-09-252-1/+13
| | | | | | | the local save/modify/restore of sys.stdout, but add machinery so that regrtest can tell test_support the value of sys.stdout at the time regrtest.main() started, and test_support can pass that out later to anyone who needs a "visible" stdout.
* test_support should be imported directly, not via test.test_support.Tim Peters2001-09-252-2/+2
|
* Get rid of the increasingly convoluted global tricks w/ sys.stdout, inTim Peters2001-09-252-28/+12
| | | | favor of local save/modify/restore. The test suite should run fine again.
* - Provisional support for pickling new-style objects. (*)Guido van Rossum2001-09-252-1/+63
| | | | | | | | | | | | | | | | | | | - 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.
* Set sys.save_stdout (to sys.stdout), so doctest-using tests can be runGuido van Rossum2001-09-251-0/+2
| | | | standalone.
* Change repr() of a new-style class to say <class 'ClassName'> ratherGuido van Rossum2001-09-252-4/+4
| | | | | | 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.
* Make __class__ assignment possible, when the object structures are theGuido van Rossum2001-09-251-0/+28
| | | | | | | | | | | | | | same. I hope the test for structural equivalence is stringent enough. It only allows the assignment if the old and new types: - have the same basic size - have the same item size - have the same dict offset - have the same weaklist offset - have the same GC flag bit - have a common base that is the same except for maybe the dict and weaklist (which may have been added separately at the same offsets in both types)
* Make properties discoverable from Python:Tim Peters2001-09-241-2/+28
| | | | | | | | | | | | | - property() now takes 4 keyword arguments: fget, fset, fdel, doc. Note that the real purpose of the 'f' prefix is to make fdel fit in ('del' is a keyword, so can't used as a keyword argument name). - These map to visible readonly attributes 'fget', 'fset', 'fdel', and '__doc__' in the property object. - fget/fset/fdel weren't discoverable from Python before. - __doc__ is new, and allows to associate a docstring with a property.