Commit Graph

928 Commits

Author SHA1 Message Date
Tim Peters fff5325078 Bug 415514 reported that e.g.
"%#x" % 0
blew up, at heart because C sprintf supplies a base marker if and only if
the value is not 0.  I then fixed that, by tolerating C's inconsistency
when it does %#x, and taking away that *Python* produced 0x0 when
formatting 0L (the "long" flavor of 0) under %#x itself.  But after talking
with Guido, we agreed it would be better to supply 0x for the short int
case too, despite that it's inconsistent with C, because C is inconsistent
with itself and with Python's hex(0) (plus, while "%#x" % 0 didn't work
before, "%#x" % 0L *did*, and returned "0x0").  Similarly for %#X conversion.
2001-04-12 18:38:48 +00:00
Tim Peters 711088d9b8 Fix for SF bug #415514: "%#x" % 0 caused assertion failure/abort.
http://sourceforge.net/tracker/index.php?func=detail&aid=415514&group_id=5470&atid=105470
For short ints, Python defers to the platform C library to figure out what
%#x should do.  The code asserted that the platform C returned a string
beginning with "0x".  However, that's not true when-- and only when --the
*value* being formatted is 0.  Changed the code to live with C's inconsistency
here.  In the meantime, the problem does not arise if you format a long 0 (0L)
instead.  However, that's because the code *we* wrote to do %#x conversions on
longs produces a leading "0x" regardless of value.  That's probably wrong too:
we should drop leading "0x", for consistency with C, when (& only when) formatting
0L.  So I changed the long formatting code to do that too.
2001-04-12 00:35:51 +00:00
Tim Peters 4642cb9ac9 Reverting the "unixware7" patch: atan2(0, 1) should be 0, regardless of
platform.  If it returns pi on the unixware7 platform, they have a bug in
their libm atan2.
2001-04-12 00:24:41 +00:00
Guido van Rossum 2242f2fbd0 Unixware 7 support by Billy G. Allie (SF patch 413011) 2001-04-11 20:58:20 +00:00
Jeremy Hylton ceccc3c037 Test cases for examples of ext call error handling.
Fix to SF bug #414743 based on Michael Hudson's patch #414750.
2001-04-11 13:53:35 +00:00
Fred Drake bf43691ccb Use the WeakKeyDictionary and WeakValueDictionary classes directly
instead of using the mapping() function.
2001-04-10 19:09:35 +00:00
Guido van Rossum 75ebb29f88 Some other tests, when failing, don't always remove their TESTFN file.
Try to do it for them, so our mkdir() operation doesn't fail.
2001-04-10 15:01:20 +00:00
Guido van Rossum a5af2148ee When doing the quick test to see whether large files are supported,
catch IOError as well as OverflowError.  I found that on Tru64 Unix
this was raised; probably because the OS (or libc) doesn't support
large files but the architecture is 64 bits!
2001-04-10 14:50:51 +00:00
Guido van Rossum bfce016a30 When zlib can't be imported, zipfile raises RuntimeError, which causes
the test to be marked as failing rather than skipped.  Add an explicit
"import zlib" to prevent this.
2001-04-10 14:46:39 +00:00
Tim Peters e089c68871 Test full range of native ints. This exposes two more binary pickle
bugs on sizeof(long)==8 machines.  pickle.py has no idea what it's
doing with very large ints, and variously gets things right by accident,
computes nonsense, or generates corrupt pickles.  cPickle fails on
cases 2**31 <= i < 2**32:  since it *thinks* those are 4-byte ints
(the "high 4 bytes" are all zeroes), it stores them in the (signed!) BININT
format, so they get unpickled as negative values.
2001-04-10 03:41:41 +00:00
Tim Peters 461922a005 Pickles have a number of storage formats for various sizes and kinds of
integers, but the std tests don't exercise most of them.  Repair that.

CAUTION:  I expect this to fail on boxes with sizeof(long)==8, in the
part of test_cpickle (but not test_pickle) trying to do a binary mode
(not text mode) load of the embedded BINDATA pickle string.  Once that
hypothesized failure is confirmed, I'll fix cPickle.c.
2001-04-09 20:07:05 +00:00
Tim Peters c58440fcef No functional change -- just added whitespace in places so I could follow
the logic better.  Will be adding some additional tests later today.
2001-04-09 17:16:31 +00:00
Tim Peters 7e01e284cb Whitespace normalization. 2001-04-08 07:44:07 +00:00
Tim Peters eb26f95906 Since Guido fiddled Cookie.py to work with doctest, it's a Good Thing to
have the std test suite exercise the Cookie doctests too.
2001-04-06 21:20:58 +00:00
Tim Peters f95423e265 Remove lines for asynchat & asyncore, as they've now got their own test. 2001-04-06 18:59:17 +00:00
Guido van Rossum dca060c55c After testing the test on Unix, several improvements:
- Use push() instead of send(), and make these calls in main().

- Sleep a second to give the server thread time to initialize itself.
2001-04-06 16:43:49 +00:00
Guido van Rossum 66172520ee Add test for asynchat. This also tests asyncore. 2001-04-06 16:32:22 +00:00
Tim Peters 7d3bad66e4 Sf bug [ #412214 ] ZipFile constructor leaves files open.
This applies the patch Fred Drake created to fix it.
I'm checking it in since I had to apply the patch anyway in order
to test its behavior on Windows.
2001-04-04 18:56:49 +00:00
Tim Peters a19a168ccc Whitespace normalization. 2001-03-29 04:36:09 +00:00
Guido van Rossum 1417144f33 Based on info from Jens@digicool.com, add 'darwin1' to the list of
BSD-style OS'es.  Makes sense, really.
2001-03-28 01:14:56 +00:00
Fred Drake 3d9091ece1 Itamar Shtull-Trauring <itamar@maxnm.com>:
Add support to zipfile to support opening an archive represented by an
open file rather than a file name.
2001-03-26 15:49:24 +00:00
Barry Warsaw 2108bc7ab0 main(): Application of SF patch #405851, which allows this test to be
used by Jython.  The tests in this module expect C locale, so be
explicit about setting that (for CPython).  However, in Jython, there
is no C locale, so instead be explicit about setting the US locale.
Closes the patch.
2001-03-23 20:24:07 +00:00
Barry Warsaw 559f6680c2 In Jython, `@' is not allowed in module names. Extend the TESTFN test
to use "$test" when in Jython.  Closes SF patch #403668.
2001-03-23 18:04:02 +00:00
Barry Warsaw 6870bba459 Make socket.getservbyname test optional on socket module having that
attribute.  Jython does not have this function.

Closes SF patch #403667.
2001-03-23 17:40:16 +00:00
Barry Warsaw dfdac1af4d Several changes for Jython portability. This closes SF patch
#403666.  Specifically,

In codestr, force `c' to be global.  It's unclear what the semantics
should be for a code object compiled at module scope, but bound and
run in a function.  In CPython, `c' is global (by accident?) while in
Jython, `c' is local.  The intent of the test clearly is to make `c'
global, so let's be explicit about it.

Jython also does not have a __builtins__ name in the module's
namespace, so we use a more portable alternative (though I'm not sure
why the test requires "__builtins__" in the g namespace).

Finally, skip the new.code() test if the new module doesn't have a
`code' attribute.  Jython will never have this.
2001-03-23 16:13:30 +00:00
Ka-Ping Yee f170d7fea7 Don't have trace() skip the top frame; return them all. 2001-03-23 05:14:10 +00:00
Fred Drake b0fefc5121 Convert the weakref test suite to PyUNIT, and add tests that exercise weak
references on function objects and both bound and unbound methods.
2001-03-23 04:22:45 +00:00
Fred Drake 84a5934f8a When the regression test is run in verbose mode, make the PyUNIT-based
tests a little noisier, providing more progress information.
2001-03-23 04:21:17 +00:00
Fredrik Lundh 015415ed14 SRE 2.1b2: increase the chances that the sre test works on other
machines...
2001-03-22 23:48:28 +00:00
Fredrik Lundh 987f1332fe SRE 2.1b2: forgot to update one output file (sorry, Fred!) 2001-03-22 23:29:04 +00:00
Fredrik Lundh 17741be466 SRE 2.1b1: don't do unicode tests under 1.5.2, or on unicode
strings/patterns.
2001-03-22 15:51:28 +00:00
Fredrik Lundh b25e1ad253 sre 2.1b2 update:
- take locale into account for word boundary anchors (#410271)
- restored 2.0's *? behaviour (#233283, #408936 and others)
- speed up re.sub/re.subn
2001-03-22 15:50:10 +00:00
Thomas Wouters b0dbeef1c4 Allow the process of reading back what we wrote to a pty to transform
linefeeds into carriagereturn-linefeeds (which is apparently what IRIX
does.) Also add some comments, an extra test and reorganize it a bit.
2001-03-22 14:50:24 +00:00
Steve Purcell 5ddd1a8dcb Updated to latest PyUnit version (1.31 in PyUnit CVS); test_support.py
changed accordingly.
2001-03-22 08:45:36 +00:00
Guido van Rossum f6e47ad4bd Check that f.keys() == [] right after creation -- this prevents bugs
like the one I just fixed to come back and haunt us.
2001-03-22 00:40:23 +00:00
Tim Peters 24a4191160 Changed doctest to run tests in alphabetic order of name.
This makes verbose-mode output easier to dig thru, and removes an accidental
dependence on the order of dict.items() (made visible by recent changes to
dictobject.c).
2001-03-21 23:07:59 +00:00
Jeremy Hylton 09ccc3a22a Test that traceback module works with SyntaxErrors with or without carets. 2001-03-21 20:33:04 +00:00
Fred Drake 91751143eb Add test cases for the fnmatch module. 2001-03-21 18:29:25 +00:00
Fred Drake cd1b1dd6d2 Just import sys at the top instead of inside lots of functions.
Add some helpers for supporting PyUNIT-based unit testing.
2001-03-21 18:26:33 +00:00
Jeremy Hylton 5c7a2513ec Add tests for recent changes:
- global stmt in class does not affect free vars in methods
- locals() works with free and cell vars
2001-03-21 16:44:39 +00:00
Tim Peters eba5130e4f Addrf simple test that import is case-sensitive. 2001-03-21 03:58:16 +00:00
Jeremy Hylton e241e29f3d Add test for a list comprehension that is nested in the left-hand part
of another list comp.  This caused crashes reported as SF bugs 409230
and 407800.

Note that the new tests are in a function so that the name lookup code
isn't affected by how many *other* list comprehensions are in the same
scope.
2001-03-19 20:42:11 +00:00
Tim Peters 9e6f278fc1 Repair test_doctest's expected-output file (Guido added some new output). 2001-03-18 20:14:25 +00:00
Tim Peters 0f33604e17 SF bug [ #409448 ] Complex division is braindead
http://sourceforge.net/tracker/?func=detail&aid=409448&group_id=5470&atid=105470
Now less braindead.  Also added test_complex.py, which doesn't test much, but
fails without this patch.
2001-03-18 08:21:57 +00:00
Tim Peters 30edd2387d Whitespace normalization. 2001-03-16 08:29:48 +00:00
Guido van Rossum a8f7e59761 Oops. A RISCOS patch I forgot to check in. 2001-03-13 09:31:07 +00:00
Jeremy Hylton 5b44a67bdb Add test to verify that nested functions with free variables don't
cause the free variables to leak.
2001-03-13 02:01:12 +00:00
Fred Drake 63085d4d1e Import the nested_scopes feature twice, to exercise the patch introduced
to avoid segfaults when more than one feature is named in the future
statement.

This tests for regression of SF bug #407394.
2001-03-10 02:18:47 +00:00
Tim Peters 243bff4708 Clean up junk files left behind by imp.load_source(). 2001-03-04 00:30:25 +00:00
Ka-Ping Yee 9054344d14 Replace literal '@test' with TESTFN. 2001-03-02 05:48:10 +00:00