Commit Graph

1965 Commits

Author SHA1 Message Date
Fred Drake fd83374fe2 Remove duplicate checks of the Node.allnodes variable. 2002-07-25 20:40:28 +00:00
Jeremy Hylton c075e197d6 Extended socket.htonl and ntohl to accept longs.
Fixes SF bug #568322.

The code should raise an OverflowError if the long is > 32 bits, even
on platforms where sizeof(long) > 4.
2002-07-25 16:01:12 +00:00
Jeremy Hylton b8a690d42a Remove test that was none too picky about whether attributes exist. 2002-07-25 15:37:23 +00:00
Barry Warsaw b5da606dfd Oops, missed an import of test_support. 2002-07-23 19:23:22 +00:00
Barry Warsaw 1bfab7bc01 A few updates about how/where to import test_support from. 2002-07-23 19:13:45 +00:00
Barry Warsaw 04f357cffe Get rid of relative imports in all unittests. Now anything that
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. :)
2002-07-23 19:04:11 +00:00
Tim Peters 7ea39b135a New test "+sort", tacking 10 random floats on to the end of a sorted
array.  Our samplesort special-cases the snot out of this, running about
12x faster than *sort.  The experimental mergesort runs it about 8x
faster than *sort without special-casing, but should really do better
than that (when merging runs of different lengths, right now it only
does something clever about finding where the second run begins in
the first and where the first run ends in the second, and that's more
of a temp-memory optimization).
2002-07-21 17:37:03 +00:00
Neal Norwitz d69030db4f Get popen test to work even if python is not in the path 2002-07-20 20:35:13 +00:00
Tim Peters 0a30e648e0 Added new test "3sort". This is sorted data but with 3 random exchanges.
It's a little better than average for our sort.
2002-07-20 04:21:51 +00:00
Guido van Rossum 65692578b7 Move the setting of os.environ['LANGUAGE'] to setup(), and reset it to
'en' in teardown().  This way hopefully test_time.py won't fail.
2002-07-20 00:36:38 +00:00
Barry Warsaw d33d47401d Shut the test up and add a missing import 2002-07-19 22:44:23 +00:00
Barry Warsaw 190390b026 The email package's tests live much better in a subpackage
(i.e. email.test), so move the guts of them here from Lib/test.  The
latter directory will retain stubs to run the email.test tests using
Python's standard regression test.

test_email_torture.py is a torture tester which will not run under
Python's test suite because I don't want to commit megs of data to
that project (it will fail cleanly there).  When run under the mimelib
project it'll stress test the package with megs of message samples
collected from various locations in the wild.
2002-07-19 22:31:10 +00:00
Fred Drake c441f7b3a6 Follow PyXML: Remove all prints from successful tests. This means we can
also drop the output file.
2002-07-19 22:16:41 +00:00
Guido van Rossum 246a58a10b Remove a few lines that aren't used and cause problems on platforms
where recvfrom() on a TCP stream returns None for the address.
This should address the remaining problems on FreeBSD.
2002-07-19 19:23:54 +00:00
Guido van Rossum 00efe7e798 Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Also adds tests.
2002-07-19 17:04:46 +00:00
Michael W. Hudson f0d777c56b A few days ago, Guido said (in the thread "[Python-Dev] Python
version of PySlice_GetIndicesEx"):

> OK.  Michael, if you want to check in indices(), go ahead.

Then I did what was needed, but didn't check it in.  Here it is.
2002-07-19 15:47:06 +00:00
Guido van Rossum b6cc7d2806 Add test for previous core dump when sending on closed socket with
timeout.

Added small sleeps to _testAccept() and _testRecv() in
NonBlockingTCPTests, to reduce race conditions (I know, this is not
the solution!)
2002-07-19 12:46:46 +00:00
Guido van Rossum 9d0c8cee66 Add default timeout functionality. This adds setdefaulttimeout() and
getdefaulttimeout() functions to the socket and _socket modules, and
appropriate tests.
2002-07-18 17:08:35 +00:00
Tim Peters 8b6ec79b74 Gave this a facelift: "/" vs "//", whrandom vs random, etc. Boosted
the default range to end at 2**20 (machines are much faster now).
Fixed what was quite a arguably a bug, explaining an old mystery:  the
"!sort" case here contructs what *was* a quadratic-time disaster for
the old quicksort implementation.  But under the current samplesort, it
always ran much faster than *sort (the random case).  This never made
sense.  Turns out it was because !sort was sorting an integer array,
while all the other cases sort floats; and comparing ints goes much
quicker than comparing floats in Python.  After changing !sort to chew
on floats instead, it's now slower than the random sort case, which
makes more sense (but is just a few percent slower; samplesort is
massively less sensitive to "bad patterns" than quicksort).
2002-07-18 15:53:32 +00:00
Tim Peters 30d4896511 Gave hotshot.LogReader a close() method, to allow users to close the
file object that LogReader opens.  Used it then in test_hotshot; the
test passes again on Windows.  Thank Guido for the analysis.
2002-07-18 14:54:28 +00:00
Tim Peters ba8c069eb9 test_hotshot fails on Windows now. Added XXX comment explaining why,
and that I don't know how to fix it.  Fred?
2002-07-17 23:52:58 +00:00
Guido van Rossum 7fadcabdee Add a test for the 'closed' attribute on the C-profiler object. 2002-07-17 16:12:53 +00:00
Jeremy Hylton ed375e18d1 Add missing comma. 2002-07-17 15:56:55 +00:00
Guido van Rossum 11c3f0999f Add a rather generous set of tests allowed to be skipped on sunos5. 2002-07-17 15:08:24 +00:00
Tim Peters c7b6bedecf Use sys.executable to run Python, as suggested by Neal Norwitz. 2002-07-17 00:34:26 +00:00
Guido van Rossum 674eae65ea Bunch of tests to make sure that StopIteration is a sink state. 2002-07-16 21:48:11 +00:00
Tim Peters c411dbaeee Whitespace normalization. 2002-07-16 21:35:23 +00:00
Tim Peters 012b69cb30 The atexit module effectively turned itself off if sys.exitfunc already
existed at the time atexit first got imported.  That's a bug, and this
fixes it.

Also reworked test_atexit.py to test for this too, and to stop using
an "expected output" file, and to test what actually happens at exit
instead of just simulating what it thinks atexit will do at exit.

Bugfix candidate, but it's messy so I'll backport to 2.2 myself.
2002-07-16 19:30:59 +00:00
Andrew MacIntyre 754140e163 Tim_one's change to aggressively overallocate nodes when adding child
nodes (in Parser/node.c) resolves the gross memory consumption
exhibited by the EMX runtime on OS/2, so the test should be exercised
on this platform.
2002-07-15 12:03:19 +00:00
Jeremy Hylton b2622a452a Remove httplib from tested modules.
The test of httplib makes it difficult to maintain httplib.  There are
two many idioms that pyclbr doesn't seem to understand, and I don't
understand how to update these tests to make them work.

Also remove commented out test of urllib2.
2002-07-12 15:54:37 +00:00
Jeremy Hylton 39c03808c7 Change _begin() back to begin().
Client code could create responses explicitly.
2002-07-12 14:04:09 +00:00
Tim Peters c62b95e550 test_trashcan() and supporting class Ouch(): Jeremy noted that this test
takes much longer to run in the context of the test suite than when run in
isolation.  That's because it forces a large number of full collections,
which take time proportional to the total number of gc'ed objects in the
whole system.

But since the dangerous implementation trickery that caused this test to
fail in 2.0, 2.1 and 2.2 doesn't exist in 2.3 anymore (the trashcan
mechanism stopped doing evil things when the possibility for compiling
without cyclic gc was taken away), such an expensive test is no longer
justified.  This checkin leaves the test intact, but fiddles the
constants to reduce the runtime by about a factor of 5.
2002-07-11 19:07:45 +00:00
Tim Peters 72351b9649 subtype_resurrection(): Removed unused import. 2002-07-11 18:39:56 +00:00
Jeremy Hylton df3f793516 Extend function() to support an optional closure argument.
Also, simplify some ref counting for other optional arguments.
2002-07-11 18:30:27 +00:00
Tim Peters 14cb1e1eff subtype_resurrection(): The test suite with -l properly reported the
immortal object here as a leak.  Made the object mortal again at the end.
2002-07-11 18:26:21 +00:00
Tim Peters 45228ca827 Repaired optimistic comment in new test. 2002-07-11 07:09:42 +00:00
Tim Peters 2484aaea15 Added a test that provokes the hypothesized (in my last checkin comment)
debug-build failure when an instance of a new-style class is resurrected
by a __del__ method -- we simply never had any code that tried this.

This is already fixed in 2.3 CVS.  In 2.2.1, it blows up via

    Fatal Python error: GC object already in linked list

I'll fix it in 2.2.1 CVS next.
2002-07-11 06:56:07 +00:00
Tim Peters 5e5ca56476 assertHasattr(): Made failure msg better than useless.
test_others():  httplib failed in two new ways.  Blame Thumb Boy <wink>.
2002-07-10 02:37:21 +00:00
Barry Warsaw c53b29e2a7 ndiffAssertEqual(): Stringify the arguments before running
.splitlines() on them, since they may be Header instances.

test_multilingual(), test_header_ctor_default_args(): New tests of
make_header() and that Header can take all default arguments.
2002-07-09 16:36:36 +00:00
Thomas Heller 6b17abf6c0 Fix SF Bug 564931: compile() traceback must include filename. 2002-07-09 09:23:27 +00:00
Barry Warsaw 329d3af443 TestEmailBase.ndiffAssertEqual(): Python 2.1's difflib doesn't have an
ndiff function, so just alias it to assertEqual in that case.

Various: make sure all openfile()/read()'s are wrapped in
try/finally's so the file gets closed.

A bunch of new tests checking the corner cases for multipart/digest
and message/rfc822.
2002-07-09 02:38:24 +00:00
Barry Warsaw e5270aea23 New files which test the corners of multipart/message and
message/rfc822 compliance.
2002-07-09 02:36:10 +00:00
Jack Jansen 1695bcb848 Got rid of special case for Macintosh realloc slowdown: Tim fixed the problem. 2002-07-08 10:07:25 +00:00
Jeremy Hylton 6d0a4c79cf Fix for SF bug #432621: httplib: multiple Set-Cookie headers
If multiple header fields with the same name occur, they are combined
according to the rules in RFC 2616 sec 4.2:

Appending each subsequent field-value to the first, each separated by
a comma. The order in which header fields with the same field-name are
received is significant to the interpretation of the combined field
value.
2002-07-07 16:51:37 +00:00
Tim Peters ba78bc4a32 printlist(): Replaced the guts with a call to textwrap. Yay! 2002-07-04 19:45:06 +00:00
Martin v. Löwis 7d650ca83b Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
2002-06-30 15:05:00 +00:00
Barry Warsaw 1969817486 Another test of long headers. 2002-06-29 15:23:39 +00:00
Barry Warsaw 9546e7972c Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133
New test cases.
2002-06-29 05:58:45 +00:00
Barry Warsaw 3fdc889e76 test_multilingual(): Test for Header.__unicode__(). 2002-06-29 03:27:27 +00:00
Jeremy Hylton 566fe9ef66 Track change of begin() to _begin(). 2002-06-28 23:54:30 +00:00
Barry Warsaw b6a9213930 Lots of new and updated tests to check for proper ascii header
folding.  Note that some of the Japanese tests have changed, but I
don't really know if they are correct or not. :(

Someone with Japanese and RFC 2047 expertise, please take a look!
2002-06-28 23:49:33 +00:00
Fred Drake 2a3d7db93e Added character data buffering to pyexpat parser objects.
Setting the buffer_text attribute to true causes the parser to collect
character data, waiting as long as possible to report it to the Python
callback.  This can save an enormous number of callbacks from C to
Python, which can be a substantial performance improvement.

buffer_text defaults to false.
2002-06-28 22:56:48 +00:00
Fred Drake 1add023b88 Integrate the tests for name interning from PyXML (test_pyexpat.py
revision 1.12 in PyXML).
2002-06-27 19:41:51 +00:00
Fred Drake 3a159a8d25 Suppress the variable verbose output from test.xmltests; the inclusion of
timing information in the output makes the determination of success bogus.
2002-06-26 15:16:16 +00:00
Fred Drake 867de944b4 Add convenience module to run all the XML tests. 2002-06-25 19:20:10 +00:00
Raymond Hettinger ab5dae35ca Fix SF bug 572567: Memory leak in object comparison. 2002-06-24 13:08:16 +00:00
Guido van Rossum 10f36d9f0b Add a check that the bug Jeremy just fixed in _PyTuple_Resize() is
fixed.

(Jeremy, how did you discover that?)
2002-06-21 02:14:10 +00:00
Raymond Hettinger 0ae0c07661 SF 569257 -- Name mangle double underscored variable names in __slots__. 2002-06-20 22:23:15 +00:00
Jack Jansen e36a8e8201 Disable the test for importing very long lists for MacPython: it triggers
an out-of-memory condition (and a hang on OSX). Filed a bug report
(#571845) to make sure this is eventually fixed.
2002-06-20 21:34:35 +00:00
Tim Peters 8db890a21a Removed the generator future-stmt -- not needed for 2.3. 2002-06-20 14:52:37 +00:00
Guido van Rossum 3875e90274 I get failures half of the time that I run this, so I'll disable
running this as part of the regular test suite again, until I have
time to figure out why.
2002-06-20 03:40:16 +00:00
Michael W. Hudson 9c14badc5f Fix the bug described in
http://mail.python.org/pipermail/python-dev/2002-June/025461.html

with test cases.

Also includes extended slice support for arrays, which I thought I'd
already checked in but obviously not.
2002-06-19 15:44:15 +00:00
Guido van Rossum 83ccb4e011 Michael fixed the race conditions and removed the sleeps.
This is his SF patch 569697.  I renamed main() to test_main() again so
that this is run as part of the standard test suite.
2002-06-18 18:35:13 +00:00
Guido van Rossum a96b0df624 Patch from SF bug 570483 (Tim Northover).
In a fresh interpreter, type.mro(tuple) would segfault, because
PyType_Ready() isn't called for tuple yet.  To fix, call
PyType_Ready(type) if type->tp_dict is NULL.
2002-06-18 16:49:45 +00:00
Piers Lauder f0a70f6d0a Alter text test arg to obey new rule, also include inverse test to make time-zone independant 2002-06-17 07:06:24 +00:00
Tim Peters 0f1afb1df3 test_module_with_large_stack(): This failed when Python was run with -O,
trying to delete a .pyc file that didn't exist (it needed to delete .pyo
then).
2002-06-15 05:14:05 +00:00
Tim Peters 06727123db test_module_with_large_stack(): This failed on Windows, for the wrong
reason <wink>:  can't unlink an open file on Windows.
2002-06-15 05:00:42 +00:00
Guido van Rossum e7f3e24eeb Test for the bug in recurse_down_subclasses() that I just fixed. 2002-06-14 02:35:45 +00:00
Neal Norwitz 7fdcb41131 Fix SF bug # 561858 Assertion with very long lists
Write 4 bytes for co_stacksize, etc. to prevent writing out
bad .pyc files which can cause a crash when read back in.
2002-06-14 01:07:39 +00:00
Neal Norwitz 1f68fc7fa5 SF bug # 493951 string.{starts,ends}with vs slices
Handle negative indices similar to slices.
2002-06-14 00:50:42 +00:00
Neal Norwitz 1b738e916f Test exceptional condition in select() 2002-06-13 22:23:47 +00:00
Neal Norwitz 6fc36c5491 Test exceptional conditions in list.sort() 2002-06-13 22:23:06 +00:00
Guido van Rossum 16b93b3d0e Fix for SF bug 532646. This is a little simpler than what Neal
suggested there, based upon a better analysis (__getattr__ is a red
herring).  Will backport to 2.2.
2002-06-13 21:32:51 +00:00
Guido van Rossum 654c11ee3a Temporarily disable the timeout and socket tests.
They still run as standalone scripts, but when used as part of the
regression test suite, they are effectively no-ops.
(This is done by renaming test_main to main.)
2002-06-13 20:24:17 +00:00
Guido van Rossum 09638c16d8 Hopefully this addresses the remaining issues of SF bugs 459235 and
473985.  Through a subtle rearrangement of some members in the etype
struct (!), mapping methods are now preferred over sequence methods,
which is necessary to support str.__getitem__("hello", slice(4)) etc.
2002-06-13 19:17:46 +00:00
Guido van Rossum 597257b940 Comment out testHostnameRes() -- it depends on a correctly working
DNS, and we can't assume that.
2002-06-13 16:54:38 +00:00
Guido van Rossum 7b8bac106a Fix non-blocking connect() for Windows. Refactored the code
that retries the connect() call in timeout mode so it can be shared
between connect() and connect_ex(), and needs only a single #ifdef.

The test for this was doing funky stuff I don't approve of,
so I removed it in favor of a simpler test.  This allowed me
to implement a simpler, "purer" form of the timeout retry code.
Hopefully that's enough (if you want to be fancy, use non-blocking
mode and decode the errors yourself, like before).
2002-06-13 16:07:04 +00:00
Guido van Rossum 11ba094957 Major overhaul of timeout sockets:
- setblocking(0) and settimeout(0) are now equivalent, and ditto for
  setblocking(1) and settimeout(None).

- Don't raise an exception from internal_select(); let the final call
  report the error (this means you will get an EAGAIN error instead of
  an ETIMEDOUT error -- I don't care).

- Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets,
  so other theads can run (this was a bug in the original code).

- Redid the retry logic in connect() and connect_ex() to avoid masking
  errors.  This probably doesn't work for Windows yet; I'll fix that
  next.  It may also fail on other platforms, depending on what
  retrying a connect does; I need help with this.

- Get rid of the retry logic in accept().  I don't think it was needed
  at all.  But I may be wrong.
2002-06-13 15:07:44 +00:00
Guido van Rossum dfad1a9039 Fix a typo.
Add a sleep (yuck!) to _testRecvFrom() so the server can set up first.
2002-06-13 15:03:01 +00:00
Guido van Rossum 3fcd45230f Whitespace nit. 2002-06-13 11:53:12 +00:00
Guido van Rossum ab659966db Remove some overly complicated ways to concatenate and repeat strings
using "".join().  Fold a long line.
2002-06-12 21:29:43 +00:00
Guido van Rossum 284a2cf07f Don't test for Java, test for sys.getrefcount. 2002-06-12 21:19:40 +00:00
Guido van Rossum 1c938014a3 Some provisional changes to get more tests to run on Windows (I hope). 2002-06-12 21:17:20 +00:00
Guido van Rossum 8e95ca85ae Argh. Typo. :-( 2002-06-12 20:55:17 +00:00
Guido van Rossum 6fb3d5ee92 Allow absent fromfd(), for Windows. 2002-06-12 20:48:59 +00:00
Guido van Rossum 733632ac1f testSetSockOpt() should not require the reuse flag to be 1 -- any
nonzero value is OK.  Also fixed the error message for this and for
testGetSockOpt().
2002-06-12 20:46:49 +00:00
Guido van Rossum 7648968716 Lose the message on assertEqual calls -- they actually hide
information on what went wrong.
2002-06-12 20:38:30 +00:00
Guido van Rossum 28774da364 Docstring, layout and style tweaking. Increase fuzz to 1 second. 2002-06-12 20:22:49 +00:00
Guido van Rossum aa6a664bbb Add some more basic tests to validate the argument checking of
settimeout(), test settimeout(None), and the interaction between
settimeout() and setblocking().
2002-06-12 19:57:18 +00:00
Guido van Rossum 24e4af8c72 New test suite for the socket module by Michael Gilfix.
Changed test_timeout.py to conform to the guidelines in Lib/test/README.
2002-06-12 19:18:08 +00:00
Guido van Rossum 05e01ee114 Add a testcase to ensure that cycles going through the __class__ link
of a new-style instance are detected by the garbage collector.
2002-06-12 14:38:04 +00:00
Guido van Rossum c5fe5eb8d2 SF bug 567538: Generator can crash the interpreter (Finn Bock).
This was a simple typo.  Strange that the compiler didn't catch it!
Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a
why_code at all, but an opcode; but even though 'why' is declared as
an enum, comparing it to an int is apparently not even worth a
warning -- not in gcc, and not in VC++. :-(

Will fix in 2.2 too.
2002-06-12 03:45:21 +00:00
Michael W. Hudson 589dc93620 Fix for problem reported by Neal Norwitz. Tighten up calculation of
slicelength.  Include his test case.
2002-06-11 13:38:42 +00:00
Michael W. Hudson 5efaf7eac8 This is my nearly two year old patch
[ 400998 ] experimental support for extended slicing on lists

somewhat spruced up and better tested than it was when I wrote it.

Includes docs & tests.  The whatsnew section needs expanding, and arrays
should support extended slices -- later.
2002-06-11 10:55:12 +00:00
Martin v. Löwis f90ae20354 Patch #488073: AtheOS port. 2002-06-11 06:22:31 +00:00
Guido van Rossum 009afb7c90 SF patch 564549 (Erik Andersén).
The WeakKeyDictionary constructor didn't work when a dict arg was
given.  Fixed by moving a line.  Also adding a unit test.

Bugfix candidate.
2002-06-10 20:00:52 +00:00
Guido van Rossum 9e9d4f8ed8 Added -t (--threshold) option to call gc.set_threshold(N). 2002-06-07 15:17:03 +00:00
Guido van Rossum 67f7a38849 SF patch 555085 (timeout socket implementation) by Michael Gilfix.
I've made considerable changes to Michael's code, specifically to use
the select() system call directly and to store the timeout as a C
double instead of a Python object; internally, -1.0 (or anything
negative) represents the None from the API.

I'm not 100% sure that all corner cases are covered correctly, so
please keep an eye on this.  Next I'm going to try it Windows before
Tim complains.

No way is this a bugfix candidate. :-)
2002-06-06 21:08:16 +00:00
Guido van Rossum a48cb8f77d Fix from SF patch 565085: copy._reduction doesn't __setstate__.
Straightforward fix.  Will backport to 2.2.  If there's ever a new 2.1
release, this could be backported there too (since it's an issue with
anything that's got both a __reduce__ and a __setstate__).
2002-06-06 17:53:03 +00:00
Raymond Hettinger 478d47a168 Close SF bug 563740. complex() now finds __complex__() in new style classes.
Made conversion failure error messages consistent between types.
Added related unittests.
2002-06-06 15:45:38 +00:00
Martin v. Löwis 446a25fa3c Patch 473512: add GNU style scanning as gnu_getopt. 2002-06-06 10:58:36 +00:00
Martin v. Löwis cdbc131f03 Patch #551911: Escape . properly. 2002-06-06 09:52:49 +00:00
Raymond Hettinger c4c453f5ae Skip Montanaro's patch, SF 559833, exposing xrange type in builtins.
Also, added more regression tests to cover the new type and test its
conformity with range().
2002-06-05 23:12:45 +00:00
Guido van Rossum d842e07470 SF bug 558179.
Change default for get() back to None.
Will backport to 2.2.1.
2002-06-05 19:07:39 +00:00
Guido van Rossum 9923ffe2c0 Address SF bug 519621: slots weren't traversed by GC.
While I was at it, I added a tp_clear handler and changed the
tp_dealloc handler to use the clear_slots helper for the tp_clear
handler.

Also tightened the rules for slot names: they must now be proper
identifiers (ignoring the dirty little fact that <ctype.h> is locale
sensitive).

Also set mp->flags = READONLY for the __weakref__ pseudo-slot.

Most of this is a 2.2 bugfix candidate; I'll apply it there myself.
2002-06-04 19:52:53 +00:00
Guido van Rossum 1bdd9b033a Test repair now that module.__init__ requires a name and initializes
__name__ and __doc__.
2002-06-04 06:10:37 +00:00
Guido van Rossum bdabeccfb8 Repair the test (adding a docstring to the module type changed the
docstring for an uninitialized module object).
2002-06-04 06:06:54 +00:00
Guido van Rossum c3a787e090 Surprising fix for SF bug 563060: module can be used as base class.
Change the module constructor (module_init) to have the signature
__init__(name:str, doc=None); this prevents the call from type_new()
to succeed.  While we're at it, prevent repeated calling of
module_init for the same module from leaking the dict, changing the
semantics so that __dict__ is only initialized if NULL.

Also adding a unittest, test_module.py.

This is an incompatibility with 2.2, if anybody was instantiating the
module class before, their argument list was probably empty; so this
can't be backported to 2.2.x.
2002-06-04 05:52:47 +00:00
Guido van Rossum 155a34d2e5 The warning filter was ineffective when this module was invoked as a
script.
2002-06-03 19:45:32 +00:00
Tim Peters c5000dfc40 regrtest has a new
-f/--fromfile <filename>
option.  This runs all and only the tests named in the file, in the
order given (although -x may weed that list, and -r may shuffle it).
Lines starting with '#' are ignored.

This goes a long way toward helping to automate the binary-search-like
procedure I keep reinventing by hand when a test fails due to interaction
among tests (no failure in isolation, and some unknown number of
predecessor tests need to run first -- now you can stick all the test
names in a file, and comment/uncomment blocks of lines until finding a
minimal set of predecessors).
2002-06-02 21:42:01 +00:00
Barry Warsaw 2c68506604 Generator.__call__() => Generator.flatten()
Also, adjust to the new message/rfc822 tree layout.
2002-06-02 19:09:27 +00:00
Raymond Hettinger 14bd6de0ec SF 560736. Optimize list iteration by filling the tp_iter slot. 2002-05-31 21:40:38 +00:00
Jeremy Hylton 05ab2e693c Fix SF bug [ 561825 ] Confusing error for "del f()"
In the error message, say del for del and assign for everything else.
2002-05-31 14:08:29 +00:00
Jeremy Hylton 40b7703f1c Verify that the imp can find and load .py files. 2002-05-30 17:10:20 +00:00
Michael W. Hudson 34f20eac98 This is patch
[ 559250 ] more POSIX signal stuff

Adds support (and docs and tests and autoconfery) for posix signal
mask handling -- sigpending, sigprocmask and sigsuspend.
2002-05-27 15:08:24 +00:00
Guido van Rossum 9fc8a29663 Fix for SF bug 551412. When _PyType_Lookup() is called on a type
whose tp_mro hasn't been initialized, it would dump core.  Fix this by
checking for NULL and calling PyType_Ready().  Will fix this in 2.2.1
too.
2002-05-24 21:40:08 +00:00
Tim Peters 8ac1495a6a Whitespace normalization. 2002-05-23 15:15:30 +00:00
Barry Warsaw f655328483 parseaddr(): Fixed in the same way that Message.getaddrlist() was
fixed (re: SF bug #555035).  Include a unittest.
2002-05-23 03:21:01 +00:00
Skip Montanaro 12424bc0ef force gzip module to open files using 'b'inary mode.
closes patch #536278.
2002-05-23 01:43:05 +00:00
Neal Norwitz d4e5be5340 Closes: #556025 seg fault when doing list(xrange(1e9))
A MemoryError is now raised when the list cannot be created.
There is a test, but as the comment says, it really only
works for 32 bit systems.  I don't know how to improve
the test for other systems (ie, 64 bit or systems
where the data size != addressable size,
e.g. 64 bit data, but 48 bit addressable memory)
2002-05-22 23:19:17 +00:00
Barry Warsaw 4be9eccbc4 getaddresses(): Like the change in rfc822.py, this one needs to access
the AddressList.addresslist attribute directly.

Also, add a test case for the email.Utils.getaddresses() interface.
2002-05-22 01:52:10 +00:00
Barry Warsaw 0a8d4d5736 Message.getaddrlist(): Use the AddressList.addresslist attribute
instead of calling the getaddrlist() method, since the latter doesn't
work with multiple calls (it will return the empty list for the second
and subsequent calls).

Closes SF bug #555035.  Include a unittest.
2002-05-21 19:46:13 +00:00
Michael W. Hudson 7b7ba54033 Guess what? --disable-unicode proofing.
This is a strange test.
2002-05-20 14:54:17 +00:00
Michael W. Hudson f207277167 More --disable-unicode stuff.
I'm getting better at vi!
2002-05-20 14:48:16 +00:00
Michael W. Hudson 9c373061ad tolerate --disable-unicode... 2002-05-20 14:24:53 +00:00
Michael W. Hudson 7c6a4ad78f More mindless --disable-unicode proofing. 2002-05-20 14:22:28 +00:00
Michael W. Hudson 286225b548 easy --disable-unicode proofing. 2002-05-20 14:15:42 +00:00
Barry Warsaw 6d86f8302f A test message w/ CRLF line endings 2002-05-19 23:53:38 +00:00
Barry Warsaw e0d85c834a Add two new tests of recent email package fixes: CRLF line endings,
and explicit maxlinelen arguments to the Header constructor.
2002-05-19 23:52:54 +00:00
Raymond Hettinger 2ae87539aa Added Mitchell Surface's regression tests for base64. Closes patch #550002. 2002-05-18 00:25:10 +00:00
Michael W. Hudson 8bf46e4e7a This is patch
[ 555382 ] test_array v.s. --disable-unicode

+ MvL's suggestions.  Just the 32 failing tests in --disable-unicode builds
now...
2002-05-15 13:04:53 +00:00
Raymond Hettinger 2d2b51bf22 Added tests for new degree/radian conversions. 2002-05-14 08:51:33 +00:00
Guido van Rossum 4402241450 Jim Fulton reported a segfault in dir(). A heavily proxied object
returned a proxy for __class__ whose __bases__ was also a proxy.  The
merge_class_dict() helper for dir() assumed incorrectly that __bases__
would always be a tuple and used the in-line tuple API on the proxy.

I will backport this to 2.2 as well.
2002-05-13 18:29:46 +00:00
Guido van Rossum df4dabd5d2 SF 554663. Add OpenBSD3. Bugfix candidate if anyone cares. 2002-05-13 14:58:02 +00:00
Michael W. Hudson e1c67d1dc0 Make StringIO work in --disable-unicode builds... 2002-05-13 09:42:16 +00:00
Raymond Hettinger 64108afa60 Adds tests for degrees() and radians() functions added to mathmodule.
Closes patch 552452 and feature request 426539.
2002-05-13 03:55:01 +00:00
Tim Peters 39a86c2188 SF bug 555042: zip() may trigger MemoryError.
NOT a bugfix candidate:  this is a fix to an optimization introduced
in 2.3.
2002-05-12 07:19:38 +00:00
Tim Peters 46c04e140c random.gauss() uses a piece of hidden state used by nothing else,
and the .seed() and .whseed() methods failed to reset it.  In other
words, setting the seed didn't completely determine the sequence of
results produced by random.gauss().  It does now.  Programs repeatedly
mixing calls to a seed method with calls to gauss() may see different
results now.

Bugfix candidate (random.gauss() has always been broken in this way),
despite that it may change results.
2002-05-05 20:40:00 +00:00
Fred Drake e08fda912f Remove all tests that rely on deprecated-in-2.2 features of xrange objects.
"What's New in Python 2.2" documented that these would be removed in
Python 2.3.
2002-05-02 18:40:31 +00:00
Fred Drake e0e890a4da Added regression tests for xrange object attributes.
See SF bug #551285.
2002-05-02 16:07:44 +00:00
Fred Drake 485f340d52 Buffer-object repitition and concatenation has worked all along; add a test
to make avoid regression.
2002-05-02 04:27:20 +00:00
Andrew MacIntyre e41abab33b Fred's recent changes to support "-u all" resulted in subset resource
selections (eg "-u network") being ignored.
2002-04-30 12:11:04 +00:00
Tim Peters 67d687a114 builtin_zip(): Take a good guess at how big the result list will be,
and allocate it in one gulp.

This isn't a bugfix, it's just a minor optimization that may or may not
pay off.
2002-04-29 21:27:32 +00:00
Guido van Rossum 7dab2426ca - New builtin function enumerate(x), from PEP 279. Example:
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
  The argument can be an arbitrary iterable object.
2002-04-26 19:40:56 +00:00
Neil Schemenauer 3b04d635a2 Add more tests for abstract isinstance() and issubclass(). 2002-04-24 03:33:02 +00:00
Tim Peters 1e33ffa5c7 test_resource has no chance of running on Windows. 2002-04-23 23:09:02 +00:00
Tim Peters e12cda9840 test_mmap started breaking on Windows, only when run after test_bsddb.
On Win2K it thought 'foo' started at byte offset 0 instead of at the
pagesize, and on Win98 it thought 'foo' didn't exist at all.  Somehow
or other this is related to the new "in memory file" gimmicks in
bsddb, but the old bsddb we use on Windows sucks so bad anyway I don't
want to bother digging deeper.  Flushing the file in test_mmap after
writing to it makes the problem go away, so good enough.
2002-04-23 23:07:28 +00:00
Barry Warsaw 906569de24 Unit tests for the changes in abstract.c version 2.101. The debug
build's "undetected error" problems were originally detected with
extension types, but we can whitebox test the same situations with
new-style classes.
2002-04-23 22:48:42 +00:00
Barry Warsaw 5ca537473b Rewrote the PyUnit description so that it now recommends to use
run_suite() instead of run_unittest().  Best practice is to plan for
multiple test classes.
2002-04-23 21:39:00 +00:00
Jeremy Hylton 74ce77f0e6 Add tests for the recent resource module change.
Also add a test that Python doesn't die with SIGXFSZ if it exceeds the
file rlimit.  (Assuming this will also test the behavior when the 2GB
limit is exceed on a platform that doesn't have large file support.)
2002-04-23 20:21:22 +00:00
Jack Jansen 1476c2753b There was a non-ascii character in the source. Replaced by a hex escape. 2002-04-23 10:52:44 +00:00
Anthony Baxter 4ce6b351cc don't fail if the audio device is busy, just skip.
SF patch 545486
2002-04-23 02:20:46 +00:00
Anthony Baxter 8388895fe4 SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL)
closes SF #514433

can now pass 'None' as the filename for the bsddb.*open functions,
and you'll get an in-memory temporary store.

docs are ripped out of the bsddb dbopen man page. Fred may want to
clean them up.

Considering this for 2.2, but not 2.1.
2002-04-23 02:11:05 +00:00
Walter Dörwald de02bcb265 Apply patch diff.txt from SF feature request
http://www.python.org/sf/444708

This adds the optional argument for str.strip
to unicode.strip too and makes it possible
to call str.strip with a unicode argument
and unicode.strip with a str argument.
2002-04-22 17:42:37 +00:00
Tim Peters 639295f0a5 Enable universal newlines on Windows. Note that NEWS needs more words! 2002-04-21 07:30:30 +00:00
Tim Peters ea572b21f8 Assorted code cleanups for readability. Greatly boosted the size of the
test data:  this test fails on WIndows now if universal newlines are
enabled (which they aren't yet, by default).  I don't know whether the
test will also fail on Linux now.
2002-04-21 06:12:02 +00:00
Jeremy Hylton 954aed8c8d Add test for eval() w/ free variables.
Related to SF bug #505315
2002-04-20 04:51:39 +00:00
Jeremy Hylton c72737e7b6 Fix SF #544995 (zlib crash on second flush call)
Bug fix by mhammond.

Bug fix candidate for 2.2, not present in 2.1.
2002-04-19 14:37:07 +00:00
Mark Hammond 3b959dbcaf Fix bug 544473 - "Queue module can deadlock".
Use try/finally to ensure all Queue locks remain stable.
Includes test case.  Bugfix candidate.
2002-04-19 00:11:32 +00:00
Tim Peters afb2c80b29 ceval.c/do_raise(): Tighten the test to disallow raising an instance of
a str subclass.

test_descr.py/string_exceptions():  New sub-test.

For 2.3 only.  Guido doesn't want this backported.
2002-04-18 18:06:20 +00:00
Tim Peters 5379dea2a7 SF bug 544733: Cygwin test_mmap fix for Python 2.2.1
Close a file before trying to unlink it, and apparently Cygwin needs
writes to an mmap'ed file to get flushed before they're visible.

Bugfix candidate, but I think only for the 2.2 line (it's testing
features that I think were new in 2.2).
2002-04-18 04:30:18 +00:00
Guido van Rossum d99b3e78dd SF bug 542984.
Change type_get_doc (the get function for __doc__) to look in tp_dict
more often, and if it finds a descriptor in tp_dict, to call it (with
a NULL instance).  This means you can add a __doc__ descriptor to a
new-style class that returns instance docs when called on an instance,
and class docs when called on a class -- or the same docs in either
case, but lazily computed.

I'll also check this into the 2.2 maintenance branch.
2002-04-18 00:27:33 +00:00
Walter Dörwald 2ee4be0775 Apply diff3.txt from SF patch http://www.python.org/sf/536241
If a str or unicode method returns the original object,
make sure that for str and unicode subclasses the original
will not be returned.

This should prevent SF bug http://www.python.org/sf/460020
from reappearing.
2002-04-17 21:34:05 +00:00
Guido van Rossum e8fc640349 SF bug 544647.
PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it
existed, even if nb_inplace_multiply also existed and the arguments
weren't right for sq_inplace_repeat.  Change this to only use
sq_inplace_repeat if nb_inplace_multiply isn't defined.

Bugfix candidate.
2002-04-16 16:44:51 +00:00
Barry Warsaw 4eaf50f435 test_mktime(): Removed. This wasn't really testing anything useful
(or platform independent).  Closes SF bug #460357.

Bug fix candidate.
2002-04-16 12:37:55 +00:00
Barry Warsaw 16f9055a9b Whitespace normalization, while using non-whitespace literals for
intended whitespace.
2002-04-16 05:06:42 +00:00
Guido van Rossum 6184c117e9 Expect test_email_codecs to be skipped -- few users or developers will
have the needed optional Japanese codecs installed.
2002-04-16 02:14:04 +00:00
Tim Peters 27dba87b78 Apparently 3 of the tests here rely on trailing whitespace and/or hard
tab characters, so reverting the whitespace normalization.  Barry,
please repair this.
2002-04-16 02:08:51 +00:00
Tim Peters 4d9b466ea5 Fewer deprecation warnings. 2002-04-16 01:59:17 +00:00
Tim Peters 863ac44b74 Whitespace normalization. 2002-04-16 01:38:40 +00:00
Tim Peters d392506c43 Tighten up some warning filters, and break some dependencies on the
order in which the tests are normally run.
2002-04-16 01:27:44 +00:00
Tim Peters 50ac30ee01 OK, don't call resetwarnings(). 2002-04-16 00:29:27 +00:00
Tim Peters 7d79948103 It makes more sense to call resetwarnings() after every test runs than
to keep doing that in every test that wants to filter a warning.
2002-04-16 00:01:09 +00:00
Tim Peters a91a02a76d I expect test_univnewlines to be skipped on Windows. I expect this
because it *is* skipped.  I'm not entirely sure it should be skipped, but
figuring that out would take actual thought <wink>.
2002-04-15 23:56:04 +00:00
Tim Peters f022a4d451 Reduce the number of test-suite DeprecationWarnings; start adding
resetwarnings() calls too.
2002-04-15 23:52:04 +00:00
Barry Warsaw c9ad32c5d1 test_main(): Added this so the test can actually get run under the
regrtest framework.  Keep the original standalone-unittest
scaffolding (i.e. suite() and __main__).
2002-04-15 22:14:06 +00:00
Walter Dörwald 068325ef92 Apply the second version of SF patch http://www.python.org/sf/536241
Add a method zfill to str, unicode and UserString and change
Lib/string.py accordingly.

This activates the zfill version in unicodeobject.c that was
commented out and implements the same in stringobject.c. It also
adds the test for unicode support in Lib/string.py back in and
uses repr() instead() of str() (as it was before Lib/string.py 1.62)
2002-04-15 13:36:47 +00:00
Guido van Rossum b6b8942f53 SF bug #541883 (Vincent Fiack).
A stupid bug in object_set_class(): didn't check for value==NULL
before checking its type.

Bugfix candidate.
2002-04-15 01:03:30 +00:00
Tim Peters 077f27141f SF bug 543840: complex(string) accepts strings with \0
complex_subtype_from_string():  this stopped parsing at the first 0
byte, as if that were the end of the input string.

Bugfix candidate.
2002-04-14 22:04:03 +00:00
Jack Jansen 518d261f63 Test suite for universal newline support. 2002-04-14 20:17:18 +00:00
Martin v. Löwis 2f6d4da278 Patch #542569: tp_print tp_repr tp_str in test_bool.py. 2002-04-14 10:22:29 +00:00
Guido van Rossum 018b0eb0f5 Partially implement SF feature request 444708.
Add optional arg to string methods strip(), lstrip(), rstrip().
The optional arg specifies characters to delete.

Also for UserString.

Still to do:

- Misc/NEWS
- LaTeX docs (I did the docstrings though)
- Unicode methods, and Unicode support in the string methods.
2002-04-13 00:56:08 +00:00
Guido van Rossum d854f3b3cc I am mad. This test never worked!
The test function's signature should be

    test(methodname, input, output, *args)

but the output argument was omitted.  This caused all tests to fail,
because the expected output was passed as the initial argument to the
method call.  But because of the way the test works (it compares the
results for a regular string to the results for a UserString instance
with the same value, and it's OK if both raise the same exception) the
test never failed!

I've fixed this, and also cleaned up a few warts in the verbose
output.  Finally, I've made it possible to run the test stand-alone in
verbose mode by passing -v as a command line argument.

Now, the test will report failure related to zfill.  That's not my
fault, that's a legitimate problem: the string_tests.py file contains
a test for the zfill() method (just added) but this method is not
implemented.  The responsible party will surely fix this soon now.
2002-04-12 16:25:39 +00:00
Guido van Rossum e027d9818f Add Raymond Hettinger's d.pop(). See SF patch 539949. 2002-04-12 15:11:59 +00:00
Fred Drake 04a8da5cdb Clean up the "all" support for -u. 2002-04-11 20:58:54 +00:00
Tim Peters a7c2b303d4 Since xmllib is deprecated now, suppress the DeprecationWarning its test
module necessarily raises.
2002-04-11 20:18:40 +00:00
Tim Peters b05cd496df Ignore more deprecation warnings. 2002-04-11 20:04:12 +00:00
Tim Peters 3c14efe696 Stop sucking up xmllib -- it's deprecated. 2002-04-11 19:54:11 +00:00
Tim Peters deb121aec7 I don't expect test_email_codecs to run on Windows. 2002-04-11 19:52:58 +00:00
Fred Drake 3a15dace36 Added the resource name "all" to enable all of the optional resource uses.
This is nice for use with "make TESTOPTS='-u all' test".
2002-04-11 16:39:16 +00:00
Fred Drake 43735da1bf Improve coverage of Objects/weakrefobject.c. 2002-04-11 03:59:42 +00:00
Barry Warsaw 409a4c08b5 Sync'ing with standalone email package 2.0.1. This adds support for
non-us-ascii character sets in headers and bodies.  Some API changes
(with DeprecationWarnings for the old APIs).  Better RFC-compliant
implementations of base64 and quoted-printable.

Updated test cases.  Documentation updates to follow (after I finish
writing them ;).
2002-04-10 21:01:31 +00:00
Marc-André Lemburg ce0b664af2 Added test case for UTF-8 encoding bug #541828. 2002-04-10 17:18:02 +00:00
Andrew M. Kuchling a9745611de Use random instead of whrandom 2002-04-10 14:54:39 +00:00
Guido van Rossum 8ace1ab53a - Changed new-style class instantiation so that when C's __new__
method returns something that's not a C instance, its __init__ is
  not called.  [SF bug #537450]
2002-04-06 01:05:01 +00:00
Guido van Rossum d1bfe5e5fd Add tests for binary pickles. 2002-04-05 20:57:02 +00:00
Guido van Rossum e276339cea Implement an idea by Paul Rubin:
Change pickling format for bools to use a backwards compatible
encoding.  This means you can pickle True or False on Python 2.3
and Python 2.2 or before will read it back as 1 or 0.  The code
used for pickling bools before would create pickles that could
not be read in previous Python versions.
2002-04-05 19:30:08 +00:00
Guido van Rossum 065fa4142a Add test case for SF bug 534347. 2002-04-04 16:27:04 +00:00
Guido van Rossum 5f8203679d Oops. Here are the new files. My apologies. 2002-04-03 23:01:45 +00:00
Guido van Rossum 77f6a65eb0 Add the 'bool' type and its values 'False' and 'True', as described in
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.
2002-04-03 22:41:51 +00:00