Commit Graph

2560 Commits

Author SHA1 Message Date
Raymond Hettinger d230550a6b Convert to unittest format so that more tests can be added cleanly. 2003-01-16 12:02:35 +00:00
Mark Hammond d800ae12f2 This test previously failed when run from the 'test' directory. In that
case, the test module created is actually a sub-package of 'test', thus
the module is named 'test.areallylongpackage...' - this caused failure.

Replace the hard-coded module names with __name__ attributes, which
correctly reflects any hierarchy.
2003-01-16 04:56:52 +00:00
Jack Jansen 8834009338 On Mac OS X calling setlocale will raise locale.Error. This isn't fatal,
so just continue testing. Fixes #668787.
2003-01-15 23:43:02 +00:00
Raymond Hettinger 2dc505e058 * Add test for __cmp__()
* Add doctest for example in the library reference manual
2003-01-15 16:15:38 +00:00
Tim Peters ddc82ea944 A new test here was failing on Windows, because the test before it never
managed to delete the @test file it intended to delete.  Also, I don't
see a reason to create a 4MB file in the new test, so cut it back to 16K.
2003-01-13 21:38:45 +00:00
Neal Norwitz 1a9975014f Fix SF bug #667147, Segmentation fault printing str subclass
Fix infinite recursion which occurred when printing an object
whose __str__() returned self.

Will backport
2003-01-13 20:13:12 +00:00
Tim Peters a9bc168f95 Got rid of the internal datetimetz type. 2003-01-11 03:39:11 +00:00
Neal Norwitz e604c02a80 SF #665913, Fix mmap module core dump with unix
Closing an mmap'ed file (calling munmap) twice on Solaris caused a core dump.

Will backport.
2003-01-10 20:52:16 +00:00
Tim Peters 37f398282b Got rid of the timetz type entirely. This was a bit trickier than I
hoped it would be, but not too bad.  A test had to change:
time.__setstate__() can no longer add a non-None tzinfo member to a time
object that didn't already have one, since storage for a tzinfo member
doesn't exist in that case.
2003-01-10 03:49:02 +00:00
Just van Rossum 6706c4d5fd cleaned up Jack's Mac OS9 changes 2003-01-09 22:27:10 +00:00
Walter Dörwald 0cb27dd023 Make the test scripts work again with narrow Python builds. 2003-01-09 11:38:50 +00:00
Walter Dörwald 30537a46ac Add a few test cases to increase code coverage:
From:
 69.73% of 294 source lines executed in file ./Modules/_codecsmodule.c
 79.47% of 487 source lines executed in file Python/codecs.c
 78.45% of 3643 source lines executed in file Objects/unicodeobject.c

To:
 70.41% of 294 source lines executed in file ./Modules/_codecsmodule.c
 82.75% of 487 source lines executed in file Python/codecs.c
 80.76% of 3638 source lines executed in file Objects/unicodeobject.c

This actually unearthed a bug in the handling of None
values in PyUnicode_EncodeCharmap.
2003-01-08 23:22:13 +00:00
Walter Dörwald 395bb49555 Add a test that exercises the error handling part of
PyUnicode_EncodeDecimal().
2003-01-08 23:02:34 +00:00
Tim Peters 0bf60bd67f Utterly minimal changes to collapse datetimetz into datetime, and timetz
into time.  This is little more than *exporting* the datetimetz object
under the name "datetime", and similarly for timetz.  A good implementation
of this change requires more work, but this is fully functional if you
don't stare too hard at the internals (e.g., right now a type named
"datetime" shows up as a base class of the type named "datetime").  The
docs also need extensive revision, not part of this checkin.
2003-01-08 20:40:01 +00:00
Jack Jansen 472e7db5c0 Various tweaks to make the test work on the Mac. 2003-01-08 16:37:03 +00:00
Jack Jansen 6797514557 Updated the list of expected skips for MacPython-OS9. 2003-01-08 16:31:11 +00:00
Jack Jansen 2918ae8fe6 n the Mac the frozen import that should fail actually succeeds, and we know it, so skip the test in stead of confusing the end user. 2003-01-08 16:30:54 +00:00
Jack Jansen ce92147cc8 Added the Mac to platforms that don't have user/group/other modes.
Set the limit for the number of open files to 32 if platform==mac.
2003-01-08 16:30:34 +00:00
Fred Drake 7511bd957d - be explicit: audio data files should be opened in binary mode
- ossaudiodev.open() raises IOError, not ossaudiodev.error, for cases
  which get mapped to TestSkipped
2003-01-08 07:09:43 +00:00
Guido van Rossum dca3f2f54a Enable building and testing of ossaudiodev for Linux. 2003-01-08 01:23:01 +00:00
Guido van Rossum 373c7412f2 Fix for SF bug #642358: only provide a new with a __dict__ or
__weaklist__ descriptor if we added __dict__ or __weaklist__,
respectively.  With unit test.
2003-01-07 13:41:37 +00:00
Raymond Hettinger 625812f618 SF patch #662433: Fill arraymodule's tp_iter and sq_contains slots 2003-01-07 01:58:52 +00:00
Guido van Rossum 613f24fd73 Add a test for a feature added in rev. 2.82 of typeobject.c:
- SLOT1BINFULL() macro: changed this to check for __rop__ overriding
  __op__, like binary_op1() in abstract.c -- the latter only calls the
  slot function once if both types use the same slot function, so the
  slot function must make both calls -- which it already did for the
  __op__, __rop__ order, but not yet for the __rop__, __op__ order
  when B.__class__ is a subclass of A.__class__.

Also test the refinement added in rev. 2.201 that fixes the problem
reported in SF bug #623669.

Also test a similar provision in abstract.c's binary_op1().
2003-01-06 23:00:59 +00:00
Guido van Rossum 2720b0dff8 Add some print statements in verbose mode to announce that the newest
tests are run.  (All tests in this module should have one of these at
the top.)
2003-01-06 21:26:44 +00:00
Skip Montanaro f09b88ee2f * add mms (windows media) as another scheme
* reformat schemes to 80 columns
2003-01-06 20:27:03 +00:00
Guido van Rossum 4f37418d02 Disable the rexec test now that rexec is out of grace. 2003-01-06 16:03:43 +00:00
Guido van Rossum 38abbf5560 Remove bastion test output 2003-01-06 16:02:12 +00:00
Guido van Rossum 11ae4e20e0 Disable the Bastion test now that Bastion is out of grace. 2003-01-06 15:45:11 +00:00
Neal Norwitz 68b539ef9c SF feature #618024, urlparse fails on imap:// 2003-01-06 06:58:31 +00:00
Neal Norwitz b9ef4aea5e SF #651082, tarfile module implementation from Lars Gustäbel 2003-01-05 23:19:43 +00:00
Neal Norwitz 502b9e1fbb At least one Solaris box in the snake farm only supports "C" locale.
Adding try/except allows the test to pass
2003-01-05 18:15:23 +00:00
Raymond Hettinger 3dd990c53a Move the statistical tests for four distributions into the unittest suite. 2003-01-05 09:20:06 +00:00
Raymond Hettinger 15ec3731cf Add a test case. 2003-01-05 01:08:34 +00:00
Tim Peters adf642038e A new implementation of astimezone() that does what we agreed on in all
cases, plus even tougher tests of that.  This implementation follows
the correctness proof very closely, and should also be quicker (yes,
I wrote the proof before the code, and the code proves the proof <wink>).
2003-01-04 06:03:15 +00:00
Raymond Hettinger 8ec78814c1 Test an edge case for sample(). 2003-01-04 05:55:11 +00:00
Just van Rossum 9a3129c148 Fix for bug #661136
Lesson learned: kids should not be allowed to use API's starting
with an underscore :-/
zipimport in 2.3a1 is even more broken than I thought: I attemped
to _PyString_Resize a string created by PyString_FromStringAndSize,
which fails for strings with length 0 or 1 since the latter returns
an interned string in those cases. This would cause a SystemError
with empty source files (and no matching pyc) in the zip archive.
I rewrote the offending code to simply allocate a new buffer and
avoid _PyString_Resize altogether.
Added a test that would've caught the problem.
2003-01-03 11:18:56 +00:00
Tim Peters 397301eccb The tzinfo methods utcoffset() and dst() must return a timedelta object
(or None) now.  In 2.3a1 they could also return an int or long, but that
was an unhelpfully redundant leftover from an earlier version wherein
they couldn't return a timedelta.  TOOWTDI.
2003-01-02 21:28:08 +00:00
Skip Montanaro 4abd5f0fce Allow list sort's comparison function to explicitly be None. See SF patch
661092.
2003-01-02 20:51:08 +00:00
Tim Peters 710fb1548a astimezone() internals: if utcoffset() returns a duration, complain if
dst() returns None (instead of treating that as 0).
2003-01-02 19:35:54 +00:00
Neal Norwitz b4a2df0c8d SF #660795
Add a test for logging from Vinay Sajip (module author)
2003-01-02 14:56:39 +00:00
Just van Rossum d35c6db526 Ugh, zipimport is virtually broken in 2.3a1 :-( It worked by accident in
the test set as it only tested with a zip archive in the current directory,
but it doesn't work at all for packages when the zip archive was specified
as an absolute path. It's a real embarrassing bug: a strchr call should
have been strrchr; fever apparently implies dyslexia.

Second stupid bug: the zipimport test failed with a name error
__importer__ (which I had renamed to __loader__ everywhere but here).
I would've sworn I ran the test after that change but that can't be true.
What I don't understand that noone reported a failing test_zipimport.py
before the release of 2.3a1.
2003-01-02 12:55:48 +00:00
Andrew MacIntyre c6fff897d7 EMX fork() emulation not good enough to cope with test_socketserver 2003-01-02 12:49:00 +00:00
Tim Peters f36151556f A quicker astimezone() implementation, rehabilitating an earlier
suggestion from Guido, along with a formal correctness proof of the
trickiest bit.  The intricacy of the proof reveals how delicate this
is, but also how robust the conclusion:  correctness doesn't rely on
dst() returning +- one hour (not all real time zones do!), it only
relies on:

1. That dst() returns a (any) non-zero value if and only if daylight
   time is in effect.

and

2. That the tzinfo subclass implements a consistent notion of time zone.

The meaning of "consistent" was a hidden assumption, which is now an
explicit requirement in the docs.  Alas, it's an unverifiable (by the
datetime implementation) requirement, but so it goes.
2003-01-01 21:51:37 +00:00
Neal Norwitz 4e8f5492c5 Revert last change -- test works on HPUX again after Martin's checkin
to 'properly configure the slave terminal'

See SF patch # 656590 for the details.
2003-01-01 14:53:27 +00:00
Tim Peters 36087edc05 The failure of the last-second addition to the timezone coversion test is
understood now:  it can't work.  Added comments explaining why (it's "the
usual"-- unrepresentable hours in local time --but in a slightly different
guise).
2003-01-01 04:18:51 +00:00
Neal Norwitz 0aae2b07d7 Comment out test, since it hangs on HPUX, still investigating 2002-12-31 18:21:11 +00:00
Martin v. Löwis 64aa5f6982 Remove bogus test; the master is not a terminal on Solaris and HP-UX. 2002-12-31 18:05:15 +00:00
Tim Peters 521fc15e62 A new, and much hairier, implementation of astimezone(), building on
an idea from Guido.  This restores that the datetime implementation
never passes a datetime d to a tzinfo method unless d.tzinfo is the
tzinfo instance whose method is being called.  That in turn allows
enormous simplifications in user-written tzinfo classes (see the Python
sandbox US.py and EU.py for fully fleshed-out examples).

d.astimezone(tz) also raises ValueError now if d lands in the one hour
of the year that can't be expressed in tz (this can happen iff tz models
both standard and daylight time).  That it used to return a nonsense
result always ate at me, and it turned out that it seemed impossible to
force a consistent nonsense result under the new implementation (which
doesn't know anything about how tzinfo classes implement their methods --
it can only infer properties indirectly).  Guido doesn't like this --
expect it to change.

New tests of conversion between adjacent DST-aware timezones don't pass
yet, and are commented out.

Running the datetime tests in a loop under a debug build leaks 9
references per test run, but I don't believe the datetime code is the
cause (it didn't leak the last time I changed the C code, and the leak
is the same if I disable all the tests that invoke the only function
that changed here).  I'll pursue that next.
2002-12-31 17:36:56 +00:00
Andrew MacIntyre c70a8e411f OS/2 EMX has no popen2.Popen3 even though bunzip2 is available 2002-12-31 11:28:22 +00:00
Andrew MacIntyre fd07e7dda7 add list of expected skips for the OS/2 EMX port 2002-12-31 11:26:50 +00:00
Fred Drake b456e4f25b Make sure PrettyPrinter methods that mirror the module-level
convenience functions isreadable() and isrecursive() work the same way
as the convenience functions.
2002-12-31 07:16:16 +00:00
Fred Drake 5478219e11 Add a test that InterpolationError is constructed properly and raised
when expected.  Only applies to the ConfigParser and SafeConfigParser
classes, not RawConfigParser.
2002-12-31 06:57:25 +00:00
Jack Jansen acda3394bb Updated the expected skips for MacOSX. 2002-12-30 23:03:13 +00:00
Jack Jansen 06f0cef1ca Skip this test on MacOSX: the locale support is too minimal to make
it pass.
2002-12-30 23:02:55 +00:00
Guido van Rossum ad50ca91a9 Brett Cannon's dummy_thread and dummy_threading modules (SF patch
622537), with some nitpicking editorial changes.
2002-12-30 22:30:22 +00:00
Just van Rossum 52e14d640b PEP 302 + zipimport:
- new import hooks in import.c, exposed in the sys module
- new module called 'zipimport'
- various changes to allow bootstrapping from zip files

I hope I didn't break the Windows build (or anything else for that
matter), but then again, it's been sitting on sf long enough...

Regarding the latest discussions on python-dev: zipimport sets
pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as
/path/to/Archive.zip/subdir/ are supported again.
2002-12-30 22:08:05 +00:00
Barry Warsaw 0a26235e67 Add some missing tests. Should now test everything that pybsddb's
test suite tests.
2002-12-30 20:53:18 +00:00
Tim Peters bad8ff089a A step on the way to making tzinfo classes writable by mortals: get rid
of the timetz case.  A tzinfo method will always see a datetimetz arg,
or None, now.  In the former case, it's still possible that it will get
a datetimetz argument belonging to a different timezone.  That will get
fixed next.
2002-12-30 20:52:32 +00:00
Neil Schemenauer 3ea60c2a7a Match new sequence behavior. User defined types now behave better as and
with sequences.
2002-12-30 20:21:15 +00:00
Tim Peters 31cc3156e7 Added tests that conversion to our own timezone is always an identity,
and that conversion to "timezone" None is the same as stripping the
tzinfo member.
2002-12-30 17:37:30 +00:00
Tim Peters 1024bf8364 Beefed up the timezone conversion test by adding a phony UTC zone that's
west of the US zones getting converted, and also by using Eastern "as if"
it were UTC (wrt Pacific), and vice versa.
2002-12-30 17:09:40 +00:00
Marc-André Lemburg 63b482cefb String tests should test 8-bit strings :-) 2002-12-30 10:50:32 +00:00
Raymond Hettinger e401b6fc55 Last checkin was missing the tuple comma.
The new "substr in str" feature masked the error.
2002-12-30 07:21:32 +00:00
Raymond Hettinger ecccafb2d4 Restore the test of the random module after including "Random" in the
ignore tuple.

The line, "from _random import Random as CoreGenerator", fools the test
code which expects CoreGenerator.__name__ to be "CoreGenerator" instead
of "Random".
2002-12-30 07:04:47 +00:00
Raymond Hettinger 4c47bd5e60 Temporarily comment out a test that crashes upon the introduction of
the _random subclass for Random.
2002-12-30 03:01:25 +00:00
Raymond Hettinger dd24a9f363 This test depends on the exact ordering produced by the WichmannHill
random number generator.  Altered it a bit to use the old generator
and restore the test.
2002-12-30 00:46:09 +00:00
Tim Peters 621818b318 A start at non-trivial (== DST-aware) tests of timezone conversion.
Guido has in mind an easier way for users to code this stuff, but the
only tests we have now are for fixed-offset tzinfo classes, and this
stuff is extremely delicate in the endcases (read the new test code
for why:  there are holes in time <wink>).
2002-12-29 23:44:49 +00:00
Raymond Hettinger 40f6217092 SF patch 658251: Install a C implementation of the Mersenne Twister as the
core generator for random.py.
2002-12-29 23:03:38 +00:00
Marc-André Lemburg 79f57833f3 Patch for bug #659709: bogus computation of float length
Python 2.2.x backport candidate. (This bug has been around since
Python 1.6.)
2002-12-29 19:44:06 +00:00
Andrew M. Kuchling 4464432d8c Suppress unsafe *Cookie class warnings 2002-12-29 16:45:06 +00:00
Tim Peters 60c76e4016 Make comparison and subtraction of aware objects ignore tzinfo if the
operands have identical tzinfo members (meaning object identity -- "is").
I misunderstood the intent here, reading wrong conclusion into
conflicting clues.
2002-12-27 00:41:11 +00:00
Guido van Rossum 9647b5240c Also skip testHostnameRes() if gethostbyaddr() raises an exception. 2002-12-26 17:04:45 +00:00
Guido van Rossum 71e02946ff Skip testHostnameRes() if gethostbyname() raises an exception. 2002-12-26 16:55:15 +00:00
Neal Norwitz 490602d629 Fix julian day problem with strptime. Note: XXX about using 0, suggestions? 2002-12-26 16:19:52 +00:00
Tim Peters 4c0db788e2 Added tests to ensure that timetz comparison, and datetimetz
subtraction, work as documented.  In the Python implementation,
they weren't calling utcoffset() if both operands had the same
tzinfo object.  That's fine if it so happens that the shared
tzinfo object returns a fixed offset (independent of operand),
but can give wrong results if that's not so, and the latter
obtains in a tzinfo subclass instance trying to model both
standard and daylight times.  The C implementation was already
doing this "correctly", so we're just adding tests to verify it.
2002-12-26 05:01:19 +00:00
Tim Peters 80475bb4d2 Implemented datetime.astimezone() and datetimetz.astimezone(). 2002-12-25 07:40:55 +00:00
Tim Peters 6578dc925f Whitespace normalization. 2002-12-24 18:31:27 +00:00
Neal Norwitz 78ce6b10ed Add test for SF #658106. Will backport. 2002-12-24 15:26:42 +00:00
Tim Peters 12bf339aea Implemented .replace() methods for date, datetime, datetimetz, time and
timetz.
2002-12-24 05:41:27 +00:00
Tim Peters cae330e449 Don't rebind True and False. 2002-12-23 16:50:58 +00:00
Tim Peters d684415572 I give up: unless I write my own strftime by hand, datetime just can't
be trusted with years before 1900, so now we raise ValueError if a date or
datetime or datetimetz .strftime() method is called with a year before
1900.
2002-12-22 20:58:42 +00:00
Tim Peters 855fe88b24 Implemented a Wiki suggestion:
{timetz,datetimetz}.{utcoffset,dst}() now return a timedelta (or None)
instead of an int (or None).

tzinfo.{utcoffset,dst)() can now return a timedelta (or an int, or None).

Curiously, this was much easier to do in the C implementation than in the
Python implementation (which lives in the Zope3 code tree) -- the C code
already had lots of hair to extract C ints from offset objects, and used
C ints internally.
2002-12-22 03:43:39 +00:00
Tim Peters b92bb71be8 Added test to ensure that non-string result from dst() raises TypeError. 2002-12-21 17:44:07 +00:00
Tim Peters fb8472c79c Changes sufficient so that pickles written by the Python implementation
can be read by the C implementation.  I don't really understand this.
2002-12-21 05:04:42 +00:00
Tim Peters 328fff7214 format_utcoffset(): The natural type of the buflen arg is size_t, so
used that.

wrap_strftime():  Removed the most irritating uses of buf.

TestDate.test_ordinal_conversions():  The C implementation is fast enough
that we can afford to check the endpoints of every year.  Also added
tm_yday tests at the endpoints.
2002-12-20 01:31:27 +00:00
Raymond Hettinger 72a6ddb5ee Expand log() tests to include long integers. 2002-12-18 16:13:16 +00:00
Michael W. Hudson cfd3884882 This is Richie Hindle's patch
[ 643835 ] Set Next Statement for Python debuggers

with a few tweaks by me: adding an unsigned or two, mentioning that
not all jumps are allowed in the doc for pdb, adding a NEWS item and
a note to whatsnew, and AuCTeX doing something cosmetic to libpdb.tex.
2002-12-17 16:15:34 +00:00
Tim Peters cfd4a8b639 Made this a little more compatible w/ the sandbox version, which is
still needed to test the Python implementatino.
2002-12-16 21:12:37 +00:00
Tim Peters 2a799bf77a datetime escapes the sandbox. The Windows build is all set. I leave it
to others to argue about how to build it on other platforms (on Windows
it's in its own DLL).
2002-12-16 20:18:38 +00:00
Raymond Hettinger 866964c3a3 Apply SF patch 652930: Add optional base argument to math.log(x[, base]). 2002-12-14 19:51:34 +00:00
Guido van Rossum 3bbc0eea10 Tighten the tests for assignment to __bases__: disallow empty tuple. 2002-12-13 17:49:38 +00:00
Martin v. Löwis de3337913f Patch #536661: Improve performance of splitext. Add test_macpath. 2002-12-12 20:30:20 +00:00
Martin v. Löwis 00b6127097 Patch #650653: Raise always value error if the table is not 256 bytes long. 2002-12-12 20:03:19 +00:00
Walter Dörwald 7e5c6a02eb Change issubclass() so that recursive tuples (directly or indirectly
containing class objects) are allowed as the second argument.
This makes issubclass() more similar to isinstance() where recursive
tuples are allowed too.
2002-12-12 19:14:08 +00:00
Jason Tishler e4a070a320 Patch #551960: Add check for setrlimit() support
test_resource calls resource.setrlimit() to change the file size limits.
This fails on Cygwin, which supports setrlimit() and getrlimit(), just not
changing that particular setting. (The same would apply to any other
platform that has those functions but not that particular feature.)

Since getrlimit() works and setrlimit() can be used for other reasons, a
check for ValueError was added to that part of the test.
2002-12-12 18:13:36 +00:00
Walter Dörwald d9a6ad3beb Enhance issubclass() and PyObject_IsSubclass() so that a tuple is
supported as the second argument. This has the same meaning as
for isinstance(), i.e. issubclass(X, (A, B)) is equivalent
to issubclass(X, A) or issubclass(X, B). Compared to isinstance(),
this patch does not search the tuple recursively for classes, i.e.
any entry in the tuple that is not a class, will result in a
TypeError.

This closes SF patch #649608.
2002-12-12 16:41:44 +00:00
Raymond Hettinger 0efa17c943 Clean-up test class for DictMixin. 2002-12-11 07:16:06 +00:00
Tim Peters efc4b12169 Added test_ossaudiodev to expected skips on Windows. 2002-12-10 18:47:56 +00:00
Greg Ward 55a8790c41 Aesthetic tweakery: factor read_sound_file() out of play_sound_file(). 2002-12-10 16:27:35 +00:00
Greg Ward 36dacfa49c Initial revision is rev 1.8 of test_linuxaudiodev.py, with
the obvious s/linuxaudiodev/ossaudiodev/ change made.
2002-12-10 16:24:21 +00:00
Tim Peters bca1cbc6f8 SF 548651: Fix the METH_CLASS implementation.
Most of these patches are from Thomas Heller, with long lines folded
by Tim.  The change to test_descr.py is from Guido.  See the bug report.

Not a bugfix candidate -- METH_CLASS is new in 2.3.
2002-12-09 22:56:13 +00:00
Greg Ward c7e3c5e306 Add test_unicode() to ensure that 1) textwrap doesn't crash on unicode
input, and 2) unicode input means unicode output.  This closes
SF bug #622831.
2002-12-09 16:32:41 +00:00
Greg Ward 24cbbcb57f Added test_initial_whitespace() to ensure that SF bug #622849 is fixed.
Change LongWordTestCase.setUp() -- remove leading whitespace from
  text string.
Comment fix.
2002-12-09 16:27:15 +00:00
Skip Montanaro 3bf99e3e87 Add support for binary pickles to the shelve module. In some situations
this can result in significantly smaller files.  All classes as well as the
open function now accept an optional binary parameter, which defaults to
False for backward compatibility.  Added a small test suite, updated the
libref documentation (including documenting the exported classes and fixing
a few other nits) and added a note about the change to Misc/NEWS.
2002-12-08 18:36:24 +00:00
Raymond Hettinger 065c06a622 Add another test which exercises the whole suite with a
heapsort and verifies the result against list.sort().
2002-12-07 10:33:42 +00:00
Raymond Hettinger c2e095f6f4 Fix typo in abstract.c which caused __rpow__ to not be invoked.
Added related testcase.
Closes SF bug #643260.
2002-12-07 10:05:27 +00:00
Raymond Hettinger babc83a27a Cleaned up test (removing bogus argument list). 2002-12-07 09:04:29 +00:00
Raymond Hettinger e03e5b1f91 Remove assumption that cls is a subclass of dict.
Simplifies the code and gets Just van Rossum's example to work.
2002-12-07 08:10:51 +00:00
Michael W. Hudson a69c030c15 The final tweaks before closing
[ 633152 ] list slice ass ignores subtypes of list

Allow arbitrary sequences on the RHS of extended slices.
2002-12-05 21:32:32 +00:00
Jason Tishler e257ec9ef7 Patch #648998: test_commands ACL patch
Although motived by Cygwin, this patch will prevent
test_commands from failing on Unixes that support
ACLs. For example, the following is an excerpt from
the Solaris ls manpage:

	...
	-rwxrwxrwx+ 1 smith dev 10876 May 16 9:42 part2

	The plus sign indicates that there is an ACL associated
	with the file.
	...
2002-12-05 20:18:39 +00:00
Tim Peters b0f89e05ad Add a Cygwin skip mentioned by Jason Tishler. 2002-12-05 17:20:25 +00:00
Jason Tishler 2511594060 Patch #551977: Regression exceptions for cygwin
This patch updates regrtest.py to understand which
tests are normally skipped under Cygwin. The list of
tests was verified with the Cygwin Python maintainer.
2002-12-05 15:18:15 +00:00
Raymond Hettinger b02bb5ed0a Replace BadInternalCall with TypeError. Add a test case. Fix whitespace.
Just van Rossum showed a weird, but clever way for pure python code to
trigger the BadInternalCall.  The C code had assumed that calling a class
constructor would return an instance of that class; however, classes that
abuse __new__ can invalidate that assumption.
2002-12-04 07:32:25 +00:00
Tim Peters b4ee4eb3b3 Rearrange test_socket_ssl so that a skip is expected iff the network
resource isn't enabled or the socket module doesn't support ssl.
2002-12-04 03:26:57 +00:00
Guido van Rossum 9d4270070a Some more expected skips on OSX. 2002-12-03 10:24:56 +00:00
Guido van Rossum 6c7340552c Lose references to knee (no longer exists) and pyclbr (has its own
test suite now).
2002-12-03 09:34:54 +00:00
Guido van Rossum 7f6a439040 Add more sophistication to the comparison between pyclbr output and
real module, by filtering out aliased methods.  This, combined with
the recent fixes to pyclbr, make it possible to enable more tests with
fewer exceptions.
2002-12-03 08:16:50 +00:00
Guido van Rossum 0ed7aa1e03 Moderately heavy reorganization of pyclbr to fix package-related bugs.
- The _modules cache now uses the full module name.

- The meaning of the (internal!!!) inpackage argument is changed: it
  now is the parent package name, or None.  readmodule() doesn't
  support this argument any more.

- The meaning of the path argument is changed: when inpackage is set,
  the module *must* be found in this path (as is the case for the real
  package search).

- Miscellaneous cleanup, e.g. fixed __all__, changed some comments and
  doc strings, etc.

- Adapted the unit tests to the new semantics (nothing much changed,
  really).  Added some debugging code to the unit tests that print
  helpful extra info to stderr when a test fails (interpreting the
  test failures turned out to be hard without these).
2002-12-02 14:54:20 +00:00
Guido van Rossum 3b10dc3554 Require 'largefile' resource for Mac OSX as well. 2002-12-02 10:42:30 +00:00
Guido van Rossum bb48465273 On Max OSX, try increasing the stack limit to 2048 so test_re and
test_sre won't die with a SegFault.
2002-12-02 09:56:21 +00:00
Ka-Ping Yee a59ef7bbe0 getdoc():
Remove leading whitespace from first line; remove leading and
    trailing blank lines from docstrings.  (Patch 645938 submitted
    by David Goodger.)
2002-11-30 03:53:15 +00:00
Michael W. Hudson ade8c8b2c3 Nudge getting __module__ and __name__ for new-style classes so that
the results of *setting* __name__ are not so surprising.

If people can suggest more tests, that'd be grand, or is what's there
sufficient?
2002-11-27 16:29:26 +00:00
Neal Norwitz deaba57009 SF #641170, reST version of Lib/test/README
Convert test/README to reST
2002-11-27 15:47:10 +00:00
Michael W. Hudson 7e7c00db0c I don't know why staring at the email to python-checkins made me
see problems with my code that I didn't see before the checkin, but:

When a subtype .mro() fails, we need to reset the type whose __bases__
are being changed, too.  Fix + test.
2002-11-27 15:40:09 +00:00
Michael W. Hudson 586da8fddd Readjustments to the way we cope with exceptions from subclasses'
mro() methods.  Now any exception aborts the whole __bases__ change.

And more tests.
2002-11-27 15:20:19 +00:00
Michael W. Hudson caf17be1b7 I had the inheritance cycle stuff backwards. Oops! 2002-11-27 10:24:44 +00:00
Martin v. Löwis e16e01fac6 Patch #639112: fixes for None locale and tz. 2002-11-27 08:30:25 +00:00
Raymond Hettinger e4827eb2a2 Bring UserDict in-sync with changes to dict.
Constructor accepts optional keyword arguments after a optional items list.
Add fromkeys() as an alternate constructor from an iterable over keys.
Expand related unittests.
2002-11-27 08:29:11 +00:00
Raymond Hettinger e33d3df030 SF Patch 643443. Added dict.fromkeys(iterable, value=None), a class
method for constructing new dictionaries from sequences of keys.
2002-11-27 07:29:33 +00:00
Guido van Rossum a01fa26396 The MRO conflict error message depends on dictionary hash order.
Avoid depending on this in the test.
2002-11-27 04:00:59 +00:00
Fred Drake 4dd0f7ef7a Add a way to say "use any resource except A". For example, to run
allow the use of any resource except bsddb, give the option
"-uall,-bsddb".
2002-11-26 21:44:56 +00:00
Michael W. Hudson 98bbc49c54 This is my patch:
[ 635933 ] make some type attrs writable

Plus a couple of extra tests beyond what's up there.

It hasn't been as carefully reviewed as it perhaps should, so all readers
are encouraged, nay exhorted, to give this a close reading.

There are still a couple of oddities related to assigning to __name__,
but I intend to solicit python-dev's opinions on these.
2002-11-26 14:47:27 +00:00
Guido van Rossum d32047f038 A tweaked version of Jeremy's patch #642489, to produce better error
messages about MRO conflicts.  (Tweaks here: don't print the message,
but compare it with an expected string.)
2002-11-25 21:38:52 +00:00
Raymond Hettinger 35e48d2426 SF 643115: Set._update() had a special case for dictionaries which allowed
non-true values to leak in.  This threw-off equality testing which depends
on the underlying dictionaries having both the same keys and values.
2002-11-25 20:43:55 +00:00
Walter Dörwald 00445d2393 Fix typo in comment. 2002-11-25 17:58:02 +00:00
Martin v. Löwis d5169bad94 Regenerate from Unicode 3.2.0 to include all First/Last ranges. 2002-11-24 23:10:08 +00:00
Tim Peters 1babdfc48a Reduced memory burden by iterating over the normalization test input
file directly (instead of sucking it all into a list of lines first).
2002-11-24 19:19:09 +00:00
Tim Peters 1b445d3fcf Fiddled things so that test_normalization is expected to be skipped if
and only if the test input file doesn't exist.
2002-11-24 18:53:11 +00:00
Tim Peters d332c085ea Skip test_normalization on Windows until it's at least clear why the
data it needs doesn't exist in the project.  If it's a huge file,
maybe the test should be changed to be one of the -u thingies.
2002-11-24 02:40:40 +00:00
Tim Peters b9ac505110 Split long line.
XXX If NormalizationTest.txt is required to run this test, why isn't it
checked into the project?
2002-11-24 02:37:29 +00:00
Tim Peters 77c06fbf94 Whitespace normalization. 2002-11-24 02:35:35 +00:00
Martin v. Löwis 677bde2dd1 Patch #626485: Support Unicode normalization. 2002-11-23 22:08:15 +00:00
Martin v. Löwis 74a530d42d Update character names. 2002-11-23 19:41:01 +00:00
Martin v. Löwis ef7fe2e813 Implement names for CJK unified ideographs. Add name to KeyError output.
Verify that the lookup for an existing name succeeds.
2002-11-23 18:01:32 +00:00
Martin v. Löwis 8579efc86c Add test cases for Hangul syllables. Update output. 2002-11-23 17:11:42 +00:00
Neal Norwitz ca2953ea5c Remove duplicate test 2002-11-23 16:57:00 +00:00
Just van Rossum a797d8150d Patch #642500 with slight modifications: allow keyword arguments in
dict() constructor. Example:
  >>> dict(a=1, b=2)
  {'a': 1, 'b': 2}
  >>>
2002-11-23 09:45:04 +00:00
Fred Drake 8bec48316b Two bugs:
- assertRaises() wasn't being called correctly
- test_warning() no longer applies
2002-11-22 20:13:43 +00:00
Tim Peters 78e35f9311 Move Windows Python away from bsddb 1.85 and toward Sleepycat's latest.
The bsddb subproject is gone.
The _bsddb subproject is new.
There are problems here, but I'm out of time to work on this now.  If
anyone can address an XXX comment or two in readme.txt, please do!
2002-11-22 20:00:34 +00:00
Raymond Hettinger 54405456e5 Implement dict() style constructor.
Already supported dict() and dict(mapping).
Now supports dict(itemsequence) and
Just van Rossum's new syntax for dict(keywordargs).

Also, added related unittests.

The docs already promise dict-like behavior
so no update is needed there.
2002-11-22 00:07:40 +00:00
Martin v. Löwis d899605e30 Patch #633547: Support plural forms. Do TODOs in test suite. 2002-11-21 21:45:32 +00:00
Walter Dörwald f171540ab8 Change int() so that passing a string, unicode, float or long argument
that is outside the integer range no longer raises OverflowError, but
returns a long object instead.

This fixes SF bug http://www.python.org/sf/635115
2002-11-19 20:49:15 +00:00
Martin v. Löwis 1c6b1a2b4e Importing test suite from bsddb3 3.4.0 (with modifications). 2002-11-19 17:47:07 +00:00
Neil Schemenauer b981df9943 check for str.__mod__ 2002-11-18 16:12:11 +00:00
Neil Schemenauer ab9e4b76c2 check for unicode.__mod__ 2002-11-18 16:11:34 +00:00
Raymond Hettinger 8ddc176e2e Improve DictMixin.
Replaced docstring with comments.  Prevents subclass contamination.
Added the missing __cmp__() method and a test for __cmp__().
Used try/except style in preference to has_key() followed by a look-up.
Used iteritem() where possible to save creating a long key list and
   to save redundant lookups.
Expanded .update() to look for the most helpful methods first and gradually
   work down to a mininum expected interface.
Expanded documentation to be more clear on how to use the class.
2002-11-18 04:34:10 +00:00
Tim Peters a1d004af04 Style guide reformats. I saw this test fail on a very heavily loaded
Win98SE box, but whatever the cause, it had scrolled off the DOS box.
(There was just the "test_queue failed" summary at the end of the
regrtest run.)
2002-11-15 19:08:50 +00:00
Raymond Hettinger 903bf90723 SF patch #520382: Expand shelve.py to have a full dictionary interface
and add a mixin to UserDict.py to make it easier to implement a full
dictionary interface.
2002-11-15 08:39:40 +00:00
Guido van Rossum 9a81892100 Fix or disable some tests that were affected by the new C3 MRO
algorithm, and add some new tests for the C3 algorithm.
2002-11-14 19:50:14 +00:00
Tim Peters c293704e93 This uses only one temp file at a time, so use test_support.TESTFN as
the name instead of enduring nanny "security warnings" from
tempfile.mktemp().
2002-11-14 16:23:29 +00:00
Jeremy Hylton 4c8be8510b Add some simple tests of the persistence hooks. 2002-11-13 22:10:47 +00:00
Jeremy Hylton 5e0f4e73a9 Remove inst_persistent_id() WANNI (we ain't never needed it).
Add some simple tests of the persistence hooks.
2002-11-13 22:01:27 +00:00
Jeremy Hylton 0e1183ddff remove debugging print 2002-11-13 22:00:02 +00:00
Jeremy Hylton cd58b8f532 Add getstate and setstate implementation to concrete set classes. 2002-11-13 19:34:26 +00:00
Neal Norwitz 80a1bf4b5d Fix SF # 635969, No error "not all arguments converted"
When mwh added extended slicing, strings and unicode became mappings.
Thus, dict was set which prevented an error when doing:
	newstr = 'format without a percent' % string_value

This fix raises an exception again when there are no formats
and % with a string value.
2002-11-12 23:01:12 +00:00
Tim Peters b9099c3df4 SF patch 637176: list.sort crasher
Armin Rigo's Draconian but effective fix for

SF bug 453523: list.sort crasher

slightly fiddled to catch more cases of list mutation.  The dreaded
internal "immutable list type" is gone!  OTOH, if you look at a list
*while* it's being sorted now, it will appear to be empty.  Better
than a core dump.
2002-11-12 22:08:10 +00:00
Martin v. Löwis 3ae84b6389 Allow both string and Unicode objects in levels. 2002-11-09 20:19:12 +00:00
Martin v. Löwis 2411a2dd82 Don't try to convert the test filename to Unicode with -U. 2002-11-09 19:57:26 +00:00
Tim Peters 44a7910873 I already forgot what I changed -- it wasn't important <wink>. 2002-11-09 06:51:30 +00:00
Tim Peters 63c1081ae3 OK -- all tests pass on Windows now. The rest were due to 3 more
binary-vs-text-mode screwups.
2002-11-09 06:49:43 +00:00
Tim Peters 9de06bd605 More tests run on Windows now. Something is still wrong here, but no
idea what.  Added liberal XXX explanations for the next guy.
2002-11-09 06:45:31 +00:00
Tim Peters 499d09af92 Many changes to get this to pass on Windows, and to make it easier to
figure out what the code was doing.  The fixes were a combination of
closing open files before deletion, opening files in binary mode, and
plain skipping things that can't work on Windows (BaseTest.decompress
uses a process gimmick that doesn't exist on Windows, and, even if it
did, assumes a "bunzip2" executable is on PATH).
2002-11-09 06:31:56 +00:00
Tim Peters 3de75266aa Whitespace normalization. 2002-11-09 05:26:15 +00:00
Tim Peters e7130315a5 Comment out the test docstrings so we can at least tell which tests are
failing.
2002-11-09 05:22:41 +00:00
Tim Peters 230a60c6ec Whitespace normalization. 2002-11-09 05:08:07 +00:00
Tim Peters ae9cbee4da Open at least one binary file in binary mode. This allows a few of the
bz2 tests to pass on Windows; most are still failing.
2002-11-09 04:44:30 +00:00
Michael W. Hudson 006c75265f This is Richie Hindle's patch:
[ 631276 ] Exceptions raised by line trace function

It conflicted with the patches from Armin I just checked it, so I had
to so some bits by hand.
2002-11-08 13:08:46 +00:00
Raymond Hettinger 1eb1fb814b Closes SF bug #628246.
The _update method detected mutable elements by trapping TypeErrors.
Unfortunately, this masked useful TypeErrors raised by the iterable
itself.  For cases where it is possible for an iterable to raise
a TypeError, the iterable is pre-converted to a list outside the
try/except so that any TypeErrors propagate through.
2002-11-08 05:03:21 +00:00
Walter Dörwald 07e147667c Make int("...") return a long if an int would overflow.
Also remove the 512 character limitation for int(u"...") and long(u"...").

This closes SF bug #629989.
2002-11-06 16:15:14 +00:00
Gustavo Niemeyer 4e7be06a65 Fixed bug #470582, using a modified version of patch #527371,
from Greg Chapman.

* Modules/_sre.c
  (lastmark_restore): New function, implementing algorithm to restore
  a state to a given lastmark. In addition to the similar algorithm used
  in a few places of SRE_MATCH, restore lastindex when restoring lastmark.
  (SRE_MATCH): Replace lastmark inline restoring by lastmark_restore(),
  function. Also include it where missing. In SRE_OP_MARK, set lastindex
  only if i > lastmark.

* Lib/test/re_tests.py
* Lib/test/test_sre.py
  Included regression tests for the fixed bugs.

* Misc/NEWS
  Mention fixes.
2002-11-06 14:06:53 +00:00
Finn Bock 57f0f3475e Skip the test_nocaret test when running as jython. Jython happens to add
a caret in this case too.
2002-11-06 11:45:15 +00:00
Finn Bock 41c570f2e7 Make the test pass for jython where there are no sys.executable. 2002-11-06 11:37:57 +00:00
Michael W. Hudson 5da854fe51 This is Alex Martelli's patch
[ 633870 ] allow any seq assignment to a list slice

plus a very silly little test case of my own.
2002-11-05 17:38:05 +00:00
Gustavo Niemeyer f8ca8364c9 Patch implementing bz2 module.
* setup.py
  (PyBuildExt.detect_modules): Included bz2 module detection.

* Modules/bz2module.c
* Lib/test/test_bz2.py
* Doc/lib/libbz2.tex
  Included files implementing, testing, and documenting bz2 module.

* Doc/Makefile.deps
* Doc/lib/lib.tex
  Include references to libbz2.tex.

* Misc/NEWS
  (Library): Mention distutils' c++ linkage patch, and new bz2 module.
2002-11-05 16:50:05 +00:00
Michael W. Hudson 173f11da5d Some days, I think my comment of
/* this is harder to get right than you might think */

angered some God somewhere.  After noticing

    >>> range(5000000)[slice(96360, None, 439)]
    []

I found that my cute test for the slice being empty failed due to
overflow.  Fixed, and added simple test (not the above!).
2002-11-05 15:28:51 +00:00
Martin v. Löwis f0a4668e6f Add getpreferredencoding. Support @euro modifiers. Fixes #554676.
The @euro part is backported to 2.2.3.
2002-11-03 17:20:12 +00:00
Neal Norwitz 26a1eefd0f Fix SF # 631066, running regrtest in user mode fails
Try to write to TESTFN, if that fails, try TESTFN in /tmp
If that fails, print a warning and go on.
Will backport.
2002-11-03 00:35:53 +00:00
Neal Norwitz e7629c85bc Skip test_dbm if we can't write to the file
Cleanup (remove) the file(s) after we are done with the test.
(Fixes problem on snake farm)
2002-11-02 18:25:08 +00:00
Finn Bock 57bc5fa60a Patch #631972: Adds an is_jython flag. 2002-11-01 18:02:03 +00:00
Finn Bock 218c5f9691 [SF bug 631713] use the import exeption message in the TestFailed
exception.
2002-11-01 11:33:00 +00:00
Greg Ward d1a72a0d5e Ad test_funky_hyphens() to test some screwy edge cases reported in SF
bug #596434.  (Alas, I don't think this completely covers that bug.)

Remove 'wrapper' argument from BaseTestCase.check_split() -- it's not
actually needed.
2002-10-31 16:11:18 +00:00
Guido van Rossum 2c9590f625 Added test for this fix to classobject.c:
Since properties are supported here, is possible that
instance_getattr2() raises an exception.  Fix all code that made this
assumption.

Backport candidate.
2002-10-29 19:08:29 +00:00
Fred Drake 9142b19216 Remove unnecessary output file. 2002-10-28 17:59:24 +00:00
Fred Drake 32f3add267 Add a test of interaction between &amp; and extra replacements.
Remove extra noise from the output when there are no errors, and say more
in the exception when there are errors.
2002-10-28 17:58:48 +00:00
Martin v. Löwis 74b51ac1e5 Patch #613256: Add nescape method to xml.sax.saxutils. 2002-10-26 14:50:45 +00:00
Fred Drake 0eebd5cef9 Implement a safer and more predictable interpolation approach.
Closes SF bug #511737.
2002-10-25 21:52:00 +00:00
Fred Drake 98e3b29b59 Add tests for both raw and non-raw versions of the items() methods. 2002-10-25 20:42:44 +00:00
Fred Drake 8811ce79f1 Remove useless output file. 2002-10-25 19:41:26 +00:00
Fred Drake c6f2891af8 Convert to PyUnit. 2002-10-25 19:40:49 +00:00
Fred Drake 3af0eb872a Added (very) minimal tests of the RawConfigParser class.
Moved the write() test to near the end of the file since it screws up
font-lock.  ;-(
2002-10-25 18:09:24 +00:00
Marc-André Lemburg 9cd87aaa54 Fix for bug #626172: crash using unicode latin1 single char
Python 2.2.3 candidate.
2002-10-23 09:02:46 +00:00
Neal Norwitz 673cd824ba Fix SF # 624982, Potential AV in slot_sq_item, by Greg Chapman
Don't crash when getting value of a property raises an exception
2002-10-18 16:33:13 +00:00
Martin v. Löwis 9def6a3a77 Update to Unicode 3.2 database. 2002-10-18 16:11:54 +00:00
Fred Drake 1e146e7876 Continue to work even though the test can be named test.test_regex
these days.
2002-10-17 22:13:28 +00:00
Fred Drake 7633d2393f Don't call warnings.resetwarnings(); that does bad things that cause
other tests to generate warning when they didn't before.  In
particular, this cancels not only filters set by -W, but also from
test.regrtest.
2002-10-17 22:09:03 +00:00
Fred Drake de4742b87f Remove spurious cruft from the output. 2002-10-17 20:36:08 +00:00
Fred Drake 707056580f Make sure we test urlsplit() / urlunsplit() directly, rather than
guessing that urlparse() / urlunparse() use them.

Add tests of urldefrag().
2002-10-16 21:02:36 +00:00
Martin v. Löwis 77ac429eff Patch #572628: Optional timeouts for put and get. 2002-10-15 15:11:13 +00:00
Guido van Rossum 6e5680fc83 For some reason (probably cut and paste), __ipow__ for new-style
classes was called with three arguments.  This makes no sense, there's
no way to pass in the "modulo" 3rd argument as for __pow__, and
classic classes don't do this.  [SF bug 620179]

I don't want to backport this to 2.2.2, because it could break
existing code that has developed a work-around.  Code in 2.2.2 that
wants to use __ipow__ and wants to be forward compatible with 2.3
should be written like this:

  def __ipow__(self, exponent, modulo=None):
      ...
2002-10-15 01:01:53 +00:00
Guido van Rossum bbc0568a5c Fix for 1.33: urlsplit() should only add '//' if scheme != ''.
Will add test and backport.
2002-10-14 19:59:54 +00:00
Michael W. Hudson 549ab8a98d A test for the recent overflow-in-format-crash bug.
Only runs when sys.maxint == 2**32 - 1; different things go wrong
on a 64-bit box.
2002-10-11 13:46:32 +00:00
Martin v. Löwis e893f2f3b4 Remove more DOS support. 2002-10-10 18:17:08 +00:00
Guido van Rossum 06e2a5e052 Add special consideration for rlcompleter. As a side effect of
initializing GNU readline, setlocale(LC_CTYPE, "") is called, which
changes the <ctype.h> macros to use the "default" locale (which isn't
the *initial* locale -- the initial locale is the "C" locale in which
only ASCII characters are printable).  When the default locale is e.g.
Latin-1, the repr() of string objects can include 8-bit characters
with the high bit set; I believe this is due to the recent
PRINT_MULTIBYTE_STRING changes to stringobject.c.  This in turn screws
up test_pyexpat and test_rotor, which depend on the repr() of 8-bit
strings with high bit characters.

The solution (for now) is to force the LC_CTYPE locale to "C" after
importing rlcompleter.  This is the locale required by the test suite
anyway.
2002-10-09 18:17:06 +00:00
Tim Peters 2a182dbf3f Logic for determining whether skipping test_pep277 is expected: whether
ths "should be" skipped depends on os.path.supports_unicode_filenames,
not really on the platform.  Fiddled the expected-skip constructor
appropriately.
2002-10-09 01:07:11 +00:00
Tim Peters cfac1d4a18 The
list(xrange(sys.maxint / 4))
test.  Changed 4 to 2.

The belief is that this test intended to trigger a bit of code in
listobject.c's NRESIZE macro that's looking for arithmetic overflow.  As
written, it doesn't achieve that, though, and leaves it up to the platform
realloc() as to whether it wants to allocate 2 gigabytes.  Some platforms
say "sure!", although they don't appear to mean it, and disaster ensues.

Changing 4 to 2 (just barely) manages to trigger the arithmetic overflow
test instead, leaving the platform realloc() out of it.

I'll backport this to the 2.2 branch next.
2002-10-08 21:01:07 +00:00
Mark Hammond 8696ebcd28 Add os.path.supports_unicode_filenames for all platforms,
sys.getwindowsversion() on Windows (new enahanced Tim-proof <wink>
version), and fix test_pep277.py in a few minor ways.
Including doc and NEWS entries.
2002-10-08 02:44:31 +00:00
Martin v. Löwis 45bb87bc13 Use escaped Unicode literals, according to PEP 8. 2002-10-07 17:27:15 +00:00
Guido van Rossum 9cce029e48 Add test_pep277 to the expected skips on Linux. (This test seems to
be skipped everywhere except on Windows NT and descendants, but I'm
only going to add it to the skip list for the platform I can test.)
2002-10-06 20:36:31 +00:00
Guido van Rossum b03fac2ded Make sure the email test suite can be run both stand-alone and under
supervision of regrtest.py.  Will backport to 2.2.2.
2002-10-06 14:37:11 +00:00
Tim Peters 1ee401fcf6 This test fails on Win98, which is fine, but when it failed it left
a junk directory behind that caused 4 other tests to fail later.  Now
it cleans up after itself, and the 4 bogus later failures don't happen.
2002-10-05 17:54:56 +00:00
Mark Hammond 7995eb22f1 Tests for pep277 - Unicode file names on Windows NT. 2002-10-03 23:14:10 +00:00
Mark Hammond c2e85bd4e2 Patch 594001: PEP 277 - Unicode file name support for Windows NT. 2002-10-03 05:10:39 +00:00
Guido van Rossum eb287a2662 Fix an endcase bug: initial_indent was ignored when the text was short
enough to fit in one line.
2002-10-02 15:47:32 +00:00
Michael W. Hudson fb4d6ecd07 Fix for the recursion_level bug Armin Rigo reported in sf
patch #617312, both on the trunk and the 22-maint branch.

Also added a test case, and ported the test_trace I wrote for HEAD
to 2.2.2 (with all those horrible extra 'line' events ;-).
2002-10-02 13:13:45 +00:00
Martin v. Löwis 21ee4091e1 Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2. 2002-09-30 16:19:48 +00:00
Jason Tishler 884554dfe5 Patch #544740: test_commands test fails under Cygwin
Relax regular expression to handle spaces in user and group names.
2002-09-30 15:44:41 +00:00
Guido van Rossum bffa52f07f Whitespace normalization (get rid of tabs). 2002-09-29 00:25:51 +00:00
Fred Drake 176916a989 Allow internal whitespace in keys.
Closes SF bug #583248; backporting to r22-maint branch.
2002-09-27 16:21:18 +00:00
Fred Drake 309db061af Added regression test for SF bug #561822: has_option() case sensitive. 2002-09-27 15:35:23 +00:00
Tim Peters d8a9d2a0e9 SF bug 613233: test_threadedtempfile hangs
A possibility to deadlock (on the hidden import lock) was created here
in 2.3, seemingly when tempfile.py started to call functions in
random.py.  The cure is "the usual":  don't spawn threads as a side
effect of importing, when the spawned threads themselves do imports
(directly or indirectly), and the code that spawned the threads is
waiting for the threads to finish (they can't finish, because they're
waiting for the import lock the spawner still holds).  Worming around
this is why the "test_main" mechanism was introduced in regrest, so
it's a straightforward fix.

NOT a bugfix candidate; the problem was introduced in 2.3.
2002-09-25 20:32:28 +00:00
Neal Norwitz 7dfb6e295b Fix SF # 591713, Fix "file:" URL to have right no. of /'s, by Bruce Atherton
Add a test too.  urljoin() would make file:/tmp/foo instead of file:///tmp/foo

Bugfix candidate, I will backport.
2002-09-25 19:20:12 +00:00
Fred Drake 04d9a80fef Add regression test for a bug found in the version of the markupbase
module used in the Zope TAL implementation.  The bug was already fixed
in the Python standard library, but the regression test would be good
to keep around.
2002-09-25 16:29:17 +00:00
Barry Warsaw 4d895fa125 Brett's fixes for various bugs and coding issues. Closes SF patch #
593560, with some minor cleanups, line folding and whitespace
normalization by Barry.
2002-09-23 22:46:49 +00:00
Martin v. Löwis a6026c6a0f Back out multifile.py 1.19 and 1.20. Fixes #514676. 2002-09-22 09:01:08 +00:00
Guido van Rossum c34c4fc3ab Suppress hex/oct constant warnings in <string> on 64-bit platforms,
because there test_grammar.py pulls them out of strings there.
2002-09-19 00:42:16 +00:00
Guido van Rossum c0a0e0810b Since it tests both ntohl and ntohs, the test should not be called
testNtoHL but testNtoH.
2002-09-16 01:30:03 +00:00
Martin v. Löwis 1ce4ae3268 Don't test whether surrogate sequences round-trip in UTF-8. 2.2.2 candidate. 2002-09-14 09:19:53 +00:00
Martin v. Löwis 766e300eaa Use integer above sys.maxunicode for range test. Fixes #608884.
2.2.2 candidate.
2002-09-14 09:10:04 +00:00
Guido van Rossum a2627afe37 Maybe this fixes test_socket on 64-bit Linux. 2002-09-14 00:58:46 +00:00
Guido van Rossum 3cda93ebf6 Add a bunch of sys.stdout.flush() calls that will hopefully improve
the usability of the output of the Xenofarm builds.
2002-09-13 21:28:03 +00:00
Fred Drake 6dd7d07aa6 If PyXML is installed, there is no Node.allnodes, so that portion of
the test should be skipped if that's the case.
2002-09-12 17:03:02 +00:00
Fred Drake d2909c901e Relax a test so it passes either with the standard library or PyXML.
The original expected value is actually wrong, but we'll pick up the
real fix and test when we refresh the xml package from PyXML before
2.3a1.
2002-09-12 17:02:01 +00:00
Guido van Rossum c8060a68ff The list(xrange(sys.maxint / 4)) test blew up on 64-bit platforms.
Because ob_size is a 32-bit int but sys.maxint is LONG_MAX which is a
64-bit value, there's no way to make this test succeed on a 64-bit
platform.  So just skip it when sys.maxint isn't 0x7fffffff.

Backport candidate.
2002-09-11 18:32:30 +00:00
Michael W. Hudson 02ff6a9952 A slight change to SET_LINENO-less tracing.
This makes things a touch more like 2.2.  Read the comments in
Python/ceval.c for more details.
2002-09-11 15:36:32 +00:00
Michael W. Hudson 519a342d79 Bunch more tests. 2002-09-11 14:47:51 +00:00
Barry Warsaw ccd9e75b18 test_both(): I believe this was a typo: m is only defined if no
exception occurred so it should only be closed in the else clause.
Without this change we can an UnboundLocalError on Linux:

Traceback (most recent call last):
  File "Lib/test/test_mmap.py", line 304, in ?
    test_both()
  File "Lib/test/test_mmap.py", line 208, in test_both
    m.close()
UnboundLocalError: local variable 'm' referenced before assignment
2002-09-11 02:56:42 +00:00
Barry Warsaw 1a5b9562d6 test_quote_unquote(): Added a test for the rfc822.unquote() patch
(adapted from Quinn Dunkan's mimelib SF patch #573204).
2002-09-11 02:32:57 +00:00
Tim Peters 1b5112ac97 I left some debugging junk in here; removed it. Also replaced a few
more instances of the bizarre "del f; del m" ways to spell .close() (del
won't do any good here under Jython, etc).
2002-09-10 21:19:55 +00:00
Tim Peters 4f4f4d70af A few days ago a test was added here to ensure that creating an mmap
with a size larger than the underlying file worked on Windows.  It
does <wink>.  However, merely creating an mmap that way has the side
effect of growing the file on disk to match the specified size.  A
*later* test assumed that the file on disk was still exactly as it was
before the new "size too big" test was added, but that's no longer true.
So added a hack at the end of the "size too big" test to truncate the
disk file back to its original size on Windows.
2002-09-10 20:49:15 +00:00
Martin v. Löwis 2412853f8e Fix escaping of non-ASCII characters. 2002-09-09 06:17:05 +00:00
Neal Norwitz 522076d1d6 Try to get test to pass on Windows 2002-09-07 05:56:21 +00:00
Jack Jansen 522e7694ed Skip UDP testing for MacPython (for now), it hangs. This may be due to
GUSI/Threading interaction, I'm not sure, but I don't have the time to fix this right now.
2002-09-06 21:57:50 +00:00
Walter Dörwald 9ab7dd4d5b Add a test case that checks that the proper exception is raises
when the replacement from an encoding error callback is itself
unencodable.
2002-09-06 17:21:40 +00:00
Neal Norwitz b567392bbf SF bug # 585792, Invalid mmap crashes Python interpreter
Raise ValueError if user passes a size to mmap which is larger
than the file.
2002-09-05 21:48:07 +00:00
Walter Dörwald 5c1ee17742 Change the unicode.translate docstring to document that
Unicode strings (with arbitrary length) are allowed
as entries in the unicode.translate mapping.

Add a test case for multicharacter replacements.

(Multicharacter replacements were enabled by the
PEP 293 patch)
2002-09-04 20:31:32 +00:00
Guido van Rossum 472c5229c4 Delete the %c test from test_date_time() untill Brett Cannon has time
to fix it.  (It fails when the day of the month is a 1-digit number,
because %c produces space+digit there, while strptime seems to expect
zero+digit somehow.)
2002-09-03 21:10:10 +00:00
Guido van Rossum 602d45194c Add a custom __str__ method to KeyError that applies repr() to the
missing key.  (Also added a guard to SyntaxError__str__ to prevent
calling PyString_Check(NULL).)
2002-09-03 20:24:09 +00:00
Guido van Rossum 6e813188db testConnectTimeout(): set the timeout to a smaller value; 0.02
sometimes wasn't short enough.
2002-09-03 19:17:47 +00:00
Walter Dörwald 8709a420c4 Check whether a string resize is necessary at the end
of PyString_DecodeEscape(). This prevents a call to
_PyString_Resize() for the empty string, which would
result in a PyErr_BadInternalCall(), because the
empty string has more than one reference.

This closes SF bug http://www.python.org/sf/603937
2002-09-03 13:53:40 +00:00
Walter Dörwald 3aeb632c31 PEP 293 implemention (from SF patch http://www.python.org/sf/432401) 2002-09-02 13:14:32 +00:00
Michael W. Hudson 53d58bb369 Further SET_LINENO reomval fixes. See comments in patch #587933.
Use a slightly different strategy to determine when not to call the line
trace function.  This removes the need for the RETURN_NONE opcode, so
that's gone again.  Update docs and comments to match.

Thanks to Neal and Armin!

Also add a test suite.  This should have come with the original patch...
2002-08-30 13:09:51 +00:00
Barry Warsaw 375e0eeacc The test I saw failing this morning just happened to be run at 8am
localtime, which in -0400 is 12 noon GMT.  The bug boiled down to
broken conversion of 12 PM to hour 12 for the '%I %p' format string.

Added a test for this specific condition: Strptime12AMPMTests.  Fix to
_strptime.py coming momentarily.
2002-08-29 15:25:04 +00:00
Guido van Rossum fc26c0730c Undo Barry's change. This file is not imported, it's fed as input to
the tokenize module by test_tokenize.py.  The FutureWarnings only
appeared during installation, and I've figured out a way to suppress
those in a different way.
2002-08-29 15:10:30 +00:00
Guido van Rossum f0253f2bc5 Restore the hex/oct constant tests that Barry commented out for fear
of FutureWarnings.  Added a comment explaining the situation.
2002-08-29 14:57:26 +00:00
Raymond Hettinger 604cd6ae79 complex() was the only numeric constructor that created a new instance
when given its own type as an argument.
2002-08-29 14:22:51 +00:00
Barry Warsaw 18bd11205d Fixed three exceptions in the Plain integers test, although I'm not
sure these are the best fixes.

- Test maxint-1 against the negative octal constant -020000000000

- Comment out the tests for oct -1 and hex -1, since 037777777777 and
  0xffffffff raise FutureWarnings now and in Python 2.4 those
  constants will produce positive values, not negative values.  So the
  existing test seems to test something that won't be true in 2.4.
2002-08-29 13:09:47 +00:00
Barry Warsaw c6f80fd995 The test_tokenize output has changed slightly, by the addition of some
trailing `L's.
2002-08-29 12:56:59 +00:00
Barry Warsaw 266e6b1f4b Quite down some FutureWarnings. 2002-08-28 16:36:11 +00:00
Tim Peters ea76c98014 Implemented <, <=, >, >= for sets, giving subset and proper-subset
meanings.  I did not add new, e.g., ispropersubset() methods; we're
going nuts on those, and, e.g., there was no "friendly name" for
== either.
2002-08-25 18:43:10 +00:00
Tim Peters 93d8d48c15 TestSubset(): Generalized the framework to support testing upcoming
<, <=, etc methods too.
2002-08-25 18:21:47 +00:00
Tim Peters 4127e91d20 Rewrote all remaining assert stmts. 2002-08-25 18:02:29 +00:00
Tim Peters 62c62438ff Simplified construction of the test suite. 2002-08-25 17:49:04 +00:00
Tim Peters de830ca4eb Simplified code building sets of characters. 2002-08-25 17:40:29 +00:00
Tim Peters a777799040 Ack! Virtually every test here relied on an assert stmt. assert stmts
should never be used in tests.  Repaired dozens, but more is needed.
2002-08-25 17:38:49 +00:00
Tim Peters 0bbb30830c Simplified the setup for is-subset testing. 2002-08-25 17:22:23 +00:00
Raymond Hettinger e87ab3fefe Removed < <= > >= from the API. Implemented as comparisons of the
underlying dictionaries, there were no reasonable use cases (lexicographic
sorting of a list of sets is somewhat esoteric).  Frees the operators
for other uses (such as strict subset and superset comparisons).

Updated documentation and test suite accordingly.
2002-08-24 07:33:06 +00:00
Raymond Hettinger 1b9f5d4c1a At Tim Peter's suggestion, propagated GvR's binary operator changes to
the inplace operators.  The strategy is to have the operator overloading
code do the work and then to define equivalent method calls which rely on
the operators.  The changes facilitate proper application of TypeError
and NonImplementedErrors.

Added corresponding tests to the test suite to make sure both the operator
and method call versions get exercised.

Add missing tests for difference_update().
2002-08-24 06:19:02 +00:00
Raymond Hettinger 045e51a9a5 Expanded tests for sets of sets. 2002-08-24 02:56:01 +00:00
Guido van Rossum 2023c9b84a Fix SF bug 599128, submitted by Inyeol Lee: .replace() would do the
wrong thing for a unicode subclass when there were zero string
replacements.  The example given in the SF bug report was only one way
to trigger this; replacing a string of length >= 2 that's not found is
another.  The code would actually write outside allocated memory if
replacement string was longer than the search string.

(I wonder how many more of these are lurking?  The unicode code base
is full of wonders.)

Bugfix candidate; this same bug is present in 2.2.1.
2002-08-23 18:50:21 +00:00
Guido van Rossum 8b1a6d694f Code by Inyeol Lee, submitted to SF bug 595350, to implement
the string/unicode method .replace() with a zero-lengt first argument.
Inyeol contributed tests for this too.
2002-08-23 18:21:28 +00:00
Tim Peters 7c7efe9073 Got rid of the toy _Set class, in favor of sets.Set. 2002-08-23 17:55:54 +00:00
Greg Ward c6edb37268 Test an em-dash with adjacent punctuation. 2002-08-22 21:27:05 +00:00
Greg Ward 715debd3d1 Factored out BaseTestCase.check_split() method -- use it wherever
we need to test TextWrapper._split().
2002-08-22 21:16:25 +00:00
Greg Ward 24a1c9cff5 Test _split() method in test_unix_options(). 2002-08-22 21:12:54 +00:00
Greg Ward 34f995b3c1 Add test_unix_options() to WrapTestCase to test for SF bug #596434. 2002-08-22 21:10:07 +00:00
Guido van Rossum ae4693129a Standardize behavior: no docstrings in test functions. 2002-08-22 20:22:16 +00:00
Guido van Rossum 9eee554bd9 Standardize behavior: no docstrings in test functions. Also use
unittest.makeSuite() rather than loader.loadTestsFromTestCase().
2002-08-22 20:21:30 +00:00
Guido van Rossum 327af775b8 Standardize behavior: no docstrings in test functions. Also strip
trailing whitespace.
2002-08-22 20:13:47 +00:00
Guido van Rossum 1c48654e01 Document that docstrings are verboten for test functions.
Expand the example to show some actual test functions, and a setUp()
and tearDown() method.
2002-08-22 20:08:14 +00:00
Guido van Rossum 8ccd9b63cc Standardize behavior: no docstrings in test functions. Also get rid
of dummy_test_TemporaryFile class; when NamedTemporaryFile and
TemporaryFile are the same, simply don't add a test suite for
TemporaryFile.
2002-08-22 20:02:03 +00:00
Guido van Rossum a5ce2e8c17 Standardize behavior: no docstrings in test functions; add a proper
test_main() that creates a suite and runs it.  Don't mess with sys.path!!!
2002-08-22 19:57:50 +00:00
Greg Ward 9ad15a3dff Add test_em_dash() to WrapTestCase to make sure that TextWrapper handles
em-dashes -- like this -- properly.  (Also--like this.  Although this
usage may be incompatible with fixing bug #596434; we shall see.)
2002-08-22 19:47:27 +00:00
Guido van Rossum 32c2ae7f4a Standardize behavior: no docstrings in test functions. 2002-08-22 19:45:32 +00:00
Guido van Rossum 2e8bba5c21 Standardize behavior: create a single suite merging all test cases. 2002-08-22 19:40:33 +00:00
Guido van Rossum 7e8fdba01c Standardize behavior: no docstrings in test functions; create a single
suite merging all test cases.
2002-08-22 19:38:14 +00:00
Guido van Rossum cb682584a3 Made it more readable. 2002-08-22 19:18:56 +00:00
Greg Ward f69d3c9849 Simplification/cleanup in IndentTestCases. 2002-08-22 19:06:45 +00:00
Greg Ward fd030e46a7 Factor LongWordTestCase out of WrapTestCase, and rename its methods
(tests) from test_funky_punc() to test_break_long() and
test_long_words() to test_nobreak_long().
2002-08-22 19:02:37 +00:00
Greg Ward 13c53c64db Rename base test case class to (yawn) BaseTestCase. 2002-08-22 18:57:26 +00:00
Greg Ward ee413849b5 Ditch the whole loop-over-subcases way of working. Add check_wrap() to
base class (WrapperTestCase) instead, and call it repeatedly in the
methods that used to have a loop-over-subcases.  Much simpler.

Rename perennial temp variable 't' to 'text'.
2002-08-22 18:55:38 +00:00
Greg Ward 9ebba9ace3 Simplify and reformat the use of 'subcases' lists (and following
for-loops) in test_simple(), test_wrap_short() test_hyphenated(), and
test_funky_punc().
2002-08-22 18:45:02 +00:00
Greg Ward 3dc94e14c0 Add comment header block.
Remove some useless comments (redundant, or info presumably available in
  PyUnit docs).
2002-08-22 18:37:50 +00:00
Greg Ward f67657811c Conform to standards documented in README:
*  lowercase test*() methods
  * define test_main() and use it instead of unittest.main()
Kill #! line.
Improve some test names and docstrings.
2002-08-22 18:35:49 +00:00
Greg Ward 90c0b071ed Test script for the textwrap module. Kindly provided by Peter Hansen
<peter@engcorp.com> based on a test script that's been kicking around my
home directory for a couple of months now and only saw the light of day
because I included it when I sent textwrap.py to python-dev for review.
2002-08-22 18:11:10 +00:00
Raymond Hettinger c3e61e5c52 Add regression test for proper construction of sets of sets. 2002-08-21 06:38:44 +00:00
Guido van Rossum c9196bc88d Rename popitem() to pop(). (An idea from SF patch 597444.) 2002-08-20 21:51:59 +00:00
Guido van Rossum 76afbd9aa4 Fix some endcase bugs in unicode rfind()/rindex() and endswith().
These were reported and fixed by Inyeol Lee in SF bug 595350.  The
endswith() bug was already fixed in 2.3, but this adds some more test
cases.
2002-08-20 17:29:29 +00:00
Guido van Rossum d6cf3af8f7 Set classes and their unit tests, from sandbox. 2002-08-19 16:19:15 +00:00
Raymond Hettinger 5959c559df Added __pow__(a,b) to the operator module. Completes the pattern of
all operators having a counterpart in the operator module.

Closes SF bug #577513.
2002-08-19 03:19:09 +00:00
Andrew MacIntyre 1d0eeec279 OS/2 EMX behaves like Windows where file permissions are concerned 2002-08-18 06:47:19 +00:00
Guido van Rossum e888cdc683 Get rid of _once(); inlining it takes less code. :-)
Also, don't call gettempdir() in the default expression for the 'dir'
argument to various functions; use 'dir=None' for the default and
insert 'if dir is None: dir = gettemptir()' in the bodies.  That way
the work done by gettempdir is postponed until needed.
2002-08-17 14:50:24 +00:00
Guido van Rossum 787410680b Patch by Zack W to make test_noinherit() more robust: spawn a Python
subprocess that does the right checks.  This now works on Windows as
well.
2002-08-17 11:41:01 +00:00
Neal Norwitz 68ee0128a2 Drop the number of test files to 100 for all the tests 2002-08-16 19:28:59 +00:00
Tim Peters 80703c8930 check_events(): This was failing under -O, due to not expecting any
LINE events when not __debug__.  But we get them anyway under -O now,
so just stop special-casing non-__debug__ mode.
2002-08-16 02:27:15 +00:00
Barry Warsaw 0a51b58e6b base64.decodestring('') should return '' instead of raising an
exception.  The bug fix for SF #430849 wasn't quite right.  This
closes SF bug #595671.  I'll backport this to Python 2.2.
2002-08-15 22:14:24 +00:00
Michael W. Hudson dd32a91cc0 This is my patch
[ 587993 ] SET_LINENO killer

Remove SET_LINENO.  Tracing is now supported by inspecting co_lnotab.

Many sundry changes to document and adapt to this change.
2002-08-15 14:59:02 +00:00
Skip Montanaro 8c91337221 forgot the best part - the new tests...
see patch 586561
2002-08-15 01:28:54 +00:00
Guido van Rossum 54df53a352 More changes of DeprecationWarning to FutureWarning. 2002-08-14 18:38:27 +00:00
Guido van Rossum 88b1defb6f The filterwarnings() call here should be updated to filter out
FutureWarning.
2002-08-14 17:54:48 +00:00
Tim Peters 04490bf225 tempfile's mkstemp(): Changed last argument from
binary=True
to
    text=False

by BDFL Pronouncement.  All other changes follow from this.  The change
to the docs is ready to go, but blocked by another JackMacLock in the
doc directory.
2002-08-14 15:41:26 +00:00
Guido van Rossum 20f0b36a04 test_many(): open only 100 temp files, not 1000. Some systems don't
allow that many open files per process.  I don't see that 1000 makes
any difference for the test.
2002-08-14 14:52:02 +00:00
Martin v. Löwis eb3f00aeeb Check for trailing backslash. Fixes #593656. 2002-08-14 08:22:50 +00:00
Martin v. Löwis 8a8da798a5 Patch #505705: Remove eval in pickle and cPickle. 2002-08-14 07:46:28 +00:00
Tim Peters 632a4fbd4d runtest(): I don't know why we don't just use TESTFN, but if we have to
do bizarre things to get a temp file, I changed it to use mkstemp instead
of NamedTemporaryFile.  This tried to leave the file open while passing
its name to execfile().  On Win2K (but not Win9X), though, a file created
with O_TEMPORARY cannot be opened again, so the test failed with a
permission error when execfile tried to open it.  Closer to the truth:
a file created with O_TEMPORARY can be opened again, but only if the
file is also created with SHARE_DELETE access via the Win32 CreateFile()
function.  There's no way to get at that from MS's version of libc, though
(we'd have to ditch the "std" C file functions in favor of Win32 API
calls).
2002-08-14 01:05:57 +00:00
Tim Peters 7f270ba860 Added a test specifically to tickle Karatsuba; it costs no appreciable
runtime.
2002-08-13 21:06:55 +00:00
Guido van Rossum 8b056da6c8 Add tests for including __dict__ and/or __weakref__ in __slots__.
Add some more rigor to slotmultipleinheritance().
2002-08-13 18:26:26 +00:00
Neal Norwitz f9dd0f1924 Add test for SF bug # 575229, multiple inheritance w/ slots dumps core
Fix already checked in by Guido
2002-08-13 17:16:49 +00:00
Jason Tishler 83499db4f0 Bug #556025: list(xrange(1e9)) --> seg fault
Close the bug report again -- this time for Cygwin due to a newlib bug.
See the following for the details:

	http://sources.redhat.com/ml/newlib/2002/msg00369.html

Note that this commit is only a documentation (i.e., comment) change.
2002-08-13 11:42:41 +00:00
Tim Peters d0876b859d test_division(): Added one larger digits value, to ensure that the
"lopsided Karatsuba" driver also gets some exercise.
2002-08-13 02:24:25 +00:00
Tim Peters 28b0e2a7f8 Machines-- and Python --are a lot faster in relevant ways since this
test was written.  So boosted the number of "digits" this generates, and
also beefed up the "* / divmod" test to tickle numbers big enough to
trigger the Karatsuba algorithm.  It takes about 2 seconds now on my box.
2002-08-13 02:17:11 +00:00
Guido van Rossum 558fc977c5 Don't use hex constants representing negative numbers. 2002-08-12 22:01:24 +00:00
Guido van Rossum dc15c27f50 Suppress warnings about test_grammar.py that can't be suppressed inside
that file itself (because it's the parser that reports them).
2002-08-12 21:55:51 +00:00
Guido van Rossum a6fa0e6f2e Portable way of producing unsigned 32-bit hex output to print the
CRCs.
2002-08-12 15:26:05 +00:00
Guido van Rossum baf29638da Shut up warnings about hex()/oct() that can't be avoided. 2002-08-12 15:16:20 +00:00
Marc-André Lemburg cc8764ca9d Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.
u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.

Closes SF bug #593581.
2002-08-11 12:23:04 +00:00
Tim Peters d92ae840e9 test_saveall(): Another small simplification; plus s/l/L/g.
test_del(), test_del_newclass():  No need to use apply() in these.
2002-08-11 04:15:09 +00:00
Tim Peters a1ad3f08ad And one more simplification to test_saveall(). 2002-08-10 21:32:16 +00:00
Tim Peters 4803c126a6 test_saveall(): Simplified a little, given that we only expect one item
in gc.garbage (so no need to loop looking for it -- it's there or it's
not).
2002-08-10 21:29:56 +00:00
Tim Peters c708c0a8c4 If any trash happened to be sitting around waiting to get collected at
the time it's called, test_saveall() made it look a leak, triggering
bogus warnings from regrtest's -l (findleaks) mode.
2002-08-10 21:20:54 +00:00
Guido van Rossum 40af889081 Disallow class assignment completely unless both old and new are heap
types.  This prevents nonsense like 2.__class__ = bool or
True.__class__ = int.
2002-08-10 05:42:07 +00:00
Fred Drake 56d1266193 Add tests for weakref support for generator-iterators.
Part of fixing SF bug #591704.
2002-08-09 18:37:10 +00:00
Tim Peters ca3ac7f639 There's no distinction among 'user', 'group' and 'world' permissions
on Win32, so tests that assume there are such distinctions can't
pass.  Fiddled them to work.
2002-08-09 18:13:51 +00:00
Tim Peters a0d55de877 Whitespace normalization. 2002-08-09 18:01:01 +00:00
Guido van Rossum 4aa21aa5b3 Test finalizers and GC from inside __del__ for new classes. 2002-08-09 17:38:16 +00:00
Guido van Rossum 3b0a3293c3 Massive changes from SF 589982 (tempfile.py rewrite, by Zack
Weinberg).  This changes all uses of deprecated tempfile functions to
the recommended ones.
2002-08-09 16:38:32 +00:00
Guido van Rossum 0e54871f82 Check-in of the most essential parts of SF 589982 (tempfile.py
rewrite, by Zack Weinberg).  This replaces most code in tempfile.py
(please review!!!) and adds extensive unit tests for it.

This will cause some warnings in the test suite; I'll check those in
soon, and also the docs.
2002-08-09 16:14:33 +00:00
Guido van Rossum 0f5f0b8057 Test for Neil's fix to correctly invoke __rmul__. 2002-08-09 16:11:37 +00:00
Guido van Rossum f36921c4b0 Unicode replace() method with empty pattern argument should fail, like
it does for 8-bit strings.
2002-08-09 15:36:48 +00:00
Raymond Hettinger c35491ee3a Moved inplace add and multiply methods from UserString to MutableString.
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
2002-08-09 01:37:06 +00:00
Raymond Hettinger 8da9da0ccc Revised the test suite for 'contains' to use the test() function argument
rather than vereq().  While it was effectively testing regular strings, it
ignored the test() function argument when called by test_userstring.py.
2002-08-09 00:43:38 +00:00
Guido van Rossum e531e296fa testSendAll(): loop until all data is read; this was necessary at
least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but
looks like the test *could* fail on any other platform too -- there's
no guarantee that recv() reads all data.
2002-08-08 20:28:34 +00:00
Tim Peters 469cdad822 Whitespace normalization. 2002-08-08 20:19:19 +00:00
Guido van Rossum 8c94383fa8 Replace docstrings on test functions witrh comments -- then unittest
prints function and module names, which is more informative now that
we repeat some tests in slightly modified subclasses.

Add a test for read() until EOF.

Add test suites for line-buffered (bufsize==1) and a small custom
buffer size (bufsize==2).

Restructure testUnbufferedRead() somewhat to avoid a potentially
infinite loop.
2002-08-08 01:00:28 +00:00
Guido van Rossum 10e3f411b0 Tighten the unbuffered readline test to distinguish between the two lines. 2002-08-07 19:02:49 +00:00
Guido van Rossum 29bf9157ec Oops. I accidentally commented out some tests. 2002-08-07 16:03:06 +00:00
Guido van Rossum e9f6614ea3 "Unbuffered" mode of class _fileobject wasn't actually unbuffered,
and this broke a Zope "pipelining" test which read multiple responses
from the same connection (this attaches a new file object to the
socket for each response).  Added a test for this too.

(I want to do some code cleanup too, but I thought I'd first fix
the problem with as little code as possible, and add a unit test
for this case.  So that's what this checkin is about.)
2002-08-07 15:46:19 +00:00
Raymond Hettinger ca84d65ca7 Expanded the unittests for the new width sensitive PyUnicode_Contains(). 2002-08-06 23:08:51 +00:00
Guido van Rossum 2d702465b3 Add testcase for SF bug 574207 (chained __slots__ dealloc segfault).
Fix forthcoming.
2002-08-06 21:28:28 +00:00
Barry Warsaw e06741704e Added a test for PyUnicode_Contains() taking into account the width of
Py_UNICODE.
2002-08-06 19:03:56 +00:00
Guido van Rossum 0855dd8938 Bump the LOOPS count. 50,000 iterations takes about 5 seconds on my
machine -- that feels just right.
2002-08-06 17:21:20 +00:00
Guido van Rossum 8ee5243434 Mark xreadlines deprecated. Don't use f.xreadlines() in test_iter.py. 2002-08-06 17:14:04 +00:00
Barry Warsaw 817918cc3c Committing patch #591250 which provides "str1 in str2" when str1 is a
string of longer than 1 character.
2002-08-06 16:58:21 +00:00
Guido van Rossum 3c668c1256 Add next and __iter__ to the list of file methods that should raise
ValueError when called for a closed file.
2002-08-06 15:58:24 +00:00
Fred Drake 63c4220f61 We only need to check for StopIteration here. 2002-08-05 22:16:40 +00:00
Martin v. Löwis 4c561b36a0 Test whether a Cyrillic text correctly appears in a Unicode literal. 2002-08-05 01:32:09 +00:00
Tim Peters 6782d6aa91 We don't really need the name of the test in the "test skipped" msg, and
having it there causes the line to wrap.
2002-08-04 22:55:35 +00:00
Tim Peters 283ead8bf2 Oops! Forgot the closing paren. 2002-08-04 22:52:30 +00:00
Tim Peters 32ef169339 Finally got around to figuring out and documenting why this test fails
on Windows.  The test_sequence() ERROR is easily repaired if we're
willing to add an os.unlink() line to mhlib's updateline().  The
test_listfolders FAIL I gave up on -- I don't remember enough about Unix
link esoterica to recall why a link count of 2 is something a well-
written program should be keenly interested in <wink>.
2002-08-04 22:35:31 +00:00
Martin v. Löwis a729daf2e4 Add encoding declaration. 2002-08-04 17:28:33 +00:00
Tim Peters 8d30b1e673 I don't know what's going on with this test, but the last change from
Piers obviously couldn't have passed on any platform.  Fiddling it so it
works (for a meaning of "works" no stronger than "doesn't fail" <wink>).
2002-08-04 06:53:18 +00:00
Piers Lauder dc96ae6c79 revert to version 1.2 2002-08-03 11:14:43 +00:00
Tim Peters 0cd53a6c37 Added new heapreplace(heap, item) function, to pop (and return) the
currently-smallest value, and add item, in one gulp.  See the second
N-Best algorithm in the test suite for a natural use.
2002-08-03 10:10:10 +00:00
Tim Peters 30e0beab6d Remove cut 'n paste silliness. 2002-08-03 02:17:41 +00:00
Tim Peters aa7d24319e Minor fiddling, including a simple class to implement a heap iterator
in the test file.  I have docs for heapq.heapify ready to check in, but
Jack appears to have left behind a stale lock in the Doc/lib directory.
2002-08-03 02:11:26 +00:00
Tim Peters 28c25527c2 Hmm! I thought I checked this in before! Oh well.
Added new heapify() function, which transforms an arbitrary list into a
heap in linear time; that's a fundamental tool for using heaps in real
life <wink>.

Added heapyify() test.  Added a "less naive" N-best algorithm to the test
suite, and noted that this could actually go much faster (building on
heapify()) if we had max-heaps instead of min-heaps (the iterative method
is appropriate when all the data isn't known in advance, but when it is
known in advance the tradeoffs get murkier).
2002-08-02 21:48:06 +00:00
Tim Peters d2cf1ab0e2 check_invariant(): Use the same child->parent "formula" used by heapq.py. 2002-08-02 19:41:54 +00:00
Tim Peters d9ea39db84 Don't use true division where int division was intended. For that matter,
don't use division at all.
2002-08-02 19:16:44 +00:00
Guido van Rossum 0b19178736 Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 18:29:53 +00:00
Skip Montanaro 13a5678a51 regression test for the whichdb module 2002-08-02 17:10:10 +00:00
Skip Montanaro f4433303a8 testGetServByName shouldn't check for getservbyname - the socket module
should always have it.
2002-08-02 15:52:30 +00:00
Tim Peters d5f4359458 New test %sort. This takes a sorted list, picks 1% of the list positions
at random, and replaces the elements at those positions with new random
values.  I was pleasantly surprised by how fast this goes!  It's hard to
conceive of an algorithm that could special-case for this effectively.
Plus it's exactly what happens if a burst of gamma rays corrupts your
sorted database on disk <wink>.

 i    2**i  *sort  ...  %sort
15   32768   0.18  ...   0.03
16   65536   0.24  ...   0.04
17  131072   0.53  ...   0.08
18  262144   1.17  ...   0.16
19  524288   2.56  ...   0.35
20 1048576   5.54  ...   0.77
2002-08-02 05:46:09 +00:00
Skip Montanaro d3c884d4ea modify testGetServByName so it tries a few different protocols. In this day
and age of rampant computer breakins I imagine there are plenty of systems
with telnet disabled.  Successful check of at least one getservbyname() call
is required for success
2002-08-02 02:19:46 +00:00
Guido van Rossum 0dbab4c560 SF patch 588728 (Nathan Srebro).
The __delete__ method wrapper for descriptors was not supported

(I added a test, too.)

2.2 bugfix candidate.
2002-08-01 14:39:25 +00:00
Tim Peters 2d8b765cc9 New test for sorting sanity. Note that this will fail in earlier Pythons,
in the stability tests.

Bizarre:  this takes 11x longer to run if and only if test_longexp is
run before it, on my box.  The bigger REPS is in test_longexp, the
slower this gets.  What happens on your box?  It's not gc on my box
(which is good, because gc isn't a plausible candidate here).

The slowdown is massive in the parts of test_sort that implicitly
invoke a new-style class's __lt__ or __cmp__ methods.  If I boost
REPS large enough in test_longexp, even the test_sort tests on an array
of size 64 visibly c-r-a-w-l.  The relative slowdown is even worse in
a debug build.  And if I reduce REPS in test_longexp, the slowdown in
test_sort goes away.

test_longexp does do horrid things to Win98's management of user
address space, but I thought I had made that a whole lot better a month
or so ago (by overallocating aggressively in the parser).
2002-08-01 02:23:06 +00:00
Tim Peters 108b7918b0 Reverting this to rev 1.3. It's apparently broken everywhere at rev
1.6, and pierslauder didn't respond to email about it on Monday.
2002-07-31 16:42:33 +00:00
Guido van Rossum b995eb79a0 Enable test_socket again, if only to prevent mistakes like Jeremy
thinking that he was running his new test by running "make test".
Also, I can't get this to fail any more.  Your turn. :-)
2002-07-31 16:08:40 +00:00
Jeremy Hylton cbd5b89571 Repair testNtoH for large long arguments.
If the long is large enough, the return value will be a negative int.
In this case, calling the function a second time won't return the
original value passed in.
2002-07-31 15:57:39 +00:00
Barry Warsaw 408b6d34de Complete the absolute import patch for the test suite. All relative
imports of test modules now import from the test package.  Other
related oddities are also fixed (like DeprecationWarning filters that
weren't specifying the full import part, etc.).  Also did a general
code cleanup to remove all "from test.test_support import *"'s.  Other
from...import *'s weren't changed.
2002-07-30 23:27:12 +00:00
Thomas Heller 3e1c18ad0c Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000).
See there for a description.

Added test case.

Bugfix candidate for 2.2.x, not sure about previous versions:
probably low priority, because virtually no one runs debug builds.
2002-07-30 11:40:57 +00:00
Michael W. Hudson 56796f672f Fix for
[ 587875 ] crash on deleting extended slice

The array code got simpler, always a good thing!
2002-07-29 14:35:04 +00:00
Neal Norwitz 88fe4ff5a9 Fix the problem of not raising a TypeError exception when doing:
'%g' % '1'
    '%d' % '1'

Add a test for these conditions
Fix the test so that if not exception is raise, this is a failure
2002-07-28 16:44:23 +00:00
Piers Lauder 139bccb2f0 remove redundant import 2002-07-27 07:10:14 +00:00
Piers Lauder 8b6bb4f743 remove redundant code 2002-07-27 07:08:38 +00:00
Piers Lauder 385a77acad remove o/s dependancy from test 2002-07-27 00:38:30 +00:00
Jack Jansen aeb6a60e03 Reorganized so the test is skipped if os.popen() doesn't exist (in stead of failing). 2002-07-26 11:33:49 +00:00
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