summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.Guido van Rossum2001-10-181-2/+119
| | | | | | | | | | | | | | | | | This is a big one, touching lots of files. Some of the platforms aren't tested yet. Briefly, this changes the return value of the os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the time functions localtime(), gmtime(), and strptime() from tuples into pseudo-sequences. When accessed as a sequence, they behave exactly as before. But they also have attributes like st_mtime or tm_year. The stat return value, moreover, has a few platform-specific attributes that are not available through the sequence interface (because everybody expects the sequence to have a fixed length, these couldn't be added there). If your platform's struct stat doesn't define st_blksize, st_blocks or st_rdev, they won't be accessible from Python either. (Still missing is a documentation update.)
* SF bug [#472347] pydoc and properties.Tim Peters2001-10-181-0/+31
| | | | | | | | | | | | | | | The GUI-mode code to display properties blew up if the property functions (get, set, etc) weren't simply methods (or functions). "The problem" here is really that the generic document() method dispatches to one of .doc{routine, class, module, other}(), but all of those require a different(!) number of arguments. Thus document isn't general-purpose at all: you have to know exactly what kind of thing is it you're going to document first, in order to pass the correct number of arguments to .document for it to pass on. As an expedient hack, just tacked "*ignored" on to the end of the formal argument lists for the .docXXX routines so that .document's caller doesn't have to know in advance which path .document is going to take.
* Do not expect line number events when running under "python -O".Fred Drake2001-10-181-0/+3
| | | | | The right fix is to generate line number events anyway ;-), but this will have to do for now.
* SRE bug #441409:Fredrik Lundh2001-10-181-0/+6
| | | | | | | | compile should raise error for non-strings SRE bug #432570, 448951: reset group after failed match also bumped version number to 2.2.0
* Add a test for calling a weakref proxy with a dictionary of keyword args.Fred Drake2001-10-181-0/+3
|
* Fix the frozen bytecode for __hello__ (betcha didn't know that existedGuido van Rossum2001-10-182-0/+30
| | | | | | | | | | :-). Add a test that prevents the __hello__ bytecode from going stale unnoticed again. The test also tests the loophole noted in SF bug #404545. This test will fail right now; I'll check in the fix in a minute.
* Make sure we do not core dump when using proxies with the binary slotFred Drake2001-10-181-0/+8
| | | | handlers. This was fixed in Objects/weakrefobject.c 1.2.
* Add test for local assigned to only in a nested list compJeremy Hylton2001-10-182-0/+19
|
* Fix SF bug #472234: type(obj) calls type->tp_init (Roeland Rengelink)Guido van Rossum2001-10-181-0/+12
| | | | | The fix is a band-aid: type_call() now makes the same exception for a single-argument call to type() as type_new() was already making.
* Add trivial test cases for RAND_add() and RAND_status().Jeremy Hylton2001-10-181-1/+15
| | | | (The rest of the test cases are trivial, so I don't feel too bad.)
* Two merges from the mimelib project:Barry Warsaw2001-10-171-0/+34
| | | | | | | | | test_no_semis_header_splitter(): This actually should still split. test_no_split_long_header(): An example of an unsplittable line. test_no_semis_header_splitter(): Test for SF bug # 471918, Generator splitting long headers.
* Make sure the output lists are sorted, even if run with -r.Jeremy Hylton2001-10-171-0/+6
|
* [ #403753 ] zlib decompress; uncontrollable memory usageJeremy Hylton2001-10-162-0/+33
| | | | | | | | | | | | | Mostly by Toby Dickenson and Titus Brown. Add an optional argument to a decompression object's decompress() method. The argument specifies the maximum length of the return value. If the uncompressed data exceeds this length, the excess data is stored as the unconsumed_tail attribute. (Not to be confused with unused_data, which is a separate issue.) Difference from SF patch: Default value for unconsumed_tail is "" rather than None. It's simpler if the attribute is always a string.
* SF bug [#468061] __str__ ignored in str subclass.Tim Peters2001-10-161-0/+31
| | | | | | | | | | | | | | | | | object.c, PyObject_Str: Don't try to optimize anything except exact string objects here; in particular, let str subclasses go thru tp_str, same as non-str objects. This allows overrides of tp_str to take effect. stringobject.c: + string_print (str's tp_print): If the argument isn't an exact string object, get one from PyObject_Str. + string_str (str's tp_str): Make a genuine-string copy of the object if it's of a proper str subclass type. str() applied to a str subclass that doesn't override __str__ ends up here. test_descr.py: New str_of_str_subclass() test.
* Remove obsolete __dynamic__ distinction.Tim Peters2001-10-151-126/+8
|
* Remove obsolete __dynamic__ distinction.Tim Peters2001-10-151-74/+1
|
* Remove obsolete __static__/__dynamic__ distinction.Tim Peters2001-10-151-11/+3
|
* Covert pickle tests to use unittest.Jeremy Hylton2001-10-155-193/+294
| | | | | Extend tests to cover a few more cases. For cPickle, test several of the undocumented features.
* Completely get rid of __dynamic__ and the correspondingGuido van Rossum2001-10-151-53/+21
| | | | | Py_TPFLAGS_DYNAMICTYPE bit. There is no longer a performance benefit, and I don't really see the use case any more.
* test_typed_subpart_iterator_default_type(): Test for when the messageBarry Warsaw2001-10-151-0/+18
| | | | has no Content-Type: header, it should be treated as text/plain.
* Remove some unused imports.Fred Drake2001-10-131-4/+17
| | | | | | Remove the log file after we are done with it. This should clean up after the test even on Windows, since the file is now closed before we attempt removal.
* You can't unlink open files on Windows.Tim Peters2001-10-131-1/+1
| | | | | | Simply commented it out, and then test_hotshot passes on Windows. Leaving to Fred to fix "the right way" (it seems to be a feature of unittest that all unittests try to unlink open files <wink>).
* A most trivial test for HotShot -- make sure we get reasonable eventsFred Drake2001-10-121-0/+81
| | | | reported and can read the log back in.
* SF bug [#470040] ParseTuple t# vs subclasses.Tim Peters2001-10-121-1/+32
| | | | | | | inherit_slots(): tp_as_buffer was getting inherited as if it were a method pointer, rather than a pointer to a vector of method pointers. As a result, inheriting from a type that implemented buffer methods was ineffective, leaving all the tp_as_buffer slots NULL in the subclass.
* Another step in the right direction: when a new class's attributeGuido van Rossum2001-10-111-16/+79
| | | | | | | | | corresponding to a dispatch slot (e.g. __getitem__ or __add__) is set, calculate the proper dispatch slot and propagate the change to all subclasses. Because of multiple inheritance, there's no easy way to avoid always recursing down the tree of subclasses. Who cares? (There's more to do, but this works. There's also a test for this now.)
* Add a test for the HeaderParser class.Barry Warsaw2001-10-111-1/+17
|
* Add test of hexlify on Unicode stringsJeremy Hylton2001-10-111-0/+4
|
* SF patch [ #468662 ] Allow jython to complete test_grammarJeremy Hylton2001-10-101-4/+14
| | | | | | The behavior of co_varnames in the presence of nested argument tuples is not consistent across Python and Jython. Test each platform separately.
* Add a bunch of tests for a list subclass that would have caught theGuido van Rossum2001-10-091-0/+22
| | | | previous embarrassment (typeobject.c checking crashing minidom).
* 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.
* 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
|