Commit Graph

2996 Commits

Author SHA1 Message Date
Walter Dörwald 1dde95dffa Move list and tuple tests from test_types.py to their own scripts:
test_tuple.py and test_list.py. Common tests for tuple, list and UserList
are shared (in seq_tests.py and list_tests.py). Port tests to PyUnit.
(From SF patch #736962)
2003-12-08 11:38:45 +00:00
Raymond Hettinger d25c1c6351 Implement itertools.groupby()
Original idea by Guido van Rossum.
Idea for skipable inner iterators by Raymond Hettinger.
Idea for argument order and identity function default by Alex Martelli.
Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger).
2003-12-06 16:23:06 +00:00
Michael W. Hudson 9da1efb5ae Remove extra copy of test_key_with_exception that somehow appeared
during a CVS merge.
2003-12-04 11:41:24 +00:00
Michael W. Hudson 1df0f654e8 Fixes and tests for various "holding pointers when arbitrary Python code
can run" bugs as discussed in

[ 848856 ] couple of new list.sort bugs
2003-12-04 11:25:46 +00:00
Tim Peters c6c5ece7e2 Typo repair; added some comments and horizontal whitespace. 2003-12-04 05:39:43 +00:00
Mark Hammond 2e8624c21a Fix test_unicode_file errors on platforms without Unicode file support,
by setting TESTFN_UNICODE_UNENCODEABLE on these platforms.
test_unicode_file only attempts to use the name for testing if not None.
2003-12-03 22:16:47 +00:00
Walter Dörwald c8de4585a6 Add parameters indent, width and depth to pprint.pprint() and pprint.pformat()
and pass them along to the PrettyPrinter constructor.
2003-12-03 20:26:05 +00:00
Walter Dörwald 7a7ede54d4 Patch #750542: pprint now will pretty print subclasses of list, tuple
and dict too, as long as they don't overwrite __repr__().
2003-12-03 20:15:28 +00:00
Guido van Rossum 291481b4db Reduce the size of Big String and Big Binary tests to 2**14 (minus one
for Big String).  This should make the tests pass on Win98SE.  Note
that the docs only promise lengths up to 2048.  Unfortunately this no
longer tests for the segfault I was seeing earlier, but I'm confident
I've nailed that one. :-)  Fixes SF 852281.  Will backport to 2.3.
2003-12-03 15:24:02 +00:00
Mark Hammond 6d459725a3 Add test for bug "[ 846133 ] os.chmod/os.utime/shutil do not work with
unicode filenames"
Reorganize tests into functions so more combinations of
unicode/encoded/ascii can be tested, and while I was at it, upgrade to
unittest based test.
2003-12-03 01:29:56 +00:00
Mark Hammond b337dd903b Add TESTFN_UNICODE_UNENCODEABLE, a unicode filename that can not be
encoded using the default file system encoding.
2003-12-03 01:27:23 +00:00
Raymond Hettinger 166958b5df As discussed on python-dev, added two extractor functions to the
operator module.
2003-12-01 13:18:39 +00:00
Guido van Rossum 0a18552b29 Add testcases for _winreg segfault (SF 851056). 2003-11-30 22:46:18 +00:00
Guido van Rossum 457bf91a7f Fix a bug discovered by Kalle Svensson: comparing sys.maxint to
2**32-1 makes no sense.  Use 2**31-1 instead.
2003-11-29 23:55:09 +00:00
Guido van Rossum 6c9e130524 - Removed FutureWarnings related to hex/oct literals and conversions
and left shifts.  (Thanks to Kalle Svensson for SF patch 849227.)
  This addresses most of the remaining semantic changes promised by
  PEP 237, except for repr() of a long, which still shows the trailing
  'L'.  The PEP appears to promise warnings for operations that
  changed semantics compared to Python 2.3, but this is not
  implemented; we've suffered through enough warnings related to
  hex/oct literals and I think it's best to be silent now.
2003-11-29 23:52:13 +00:00
Raymond Hettinger 37e136373e Make sure the list.sort's decorate step unwinds itself before returning
an exception raised by the key function.
(Suggested by Michael Hudson.)
2003-11-28 21:43:02 +00:00
Raymond Hettinger 4f8f976576 Add optional fillchar argument to ljust(), rjust(), and center() string methods. 2003-11-26 08:21:35 +00:00
Raymond Hettinger f5f41bf087 * Checkin remaining documentation
* Add more tests
* Refactor and neaten the code a bit.
* Rename union_update() to update().
* Improve the algorithms (making them a closer to sets.py).
2003-11-24 02:57:33 +00:00
Barry Warsaw ceca5d2924 test_guess_all_types(): Use a more robust test for checking that
guess_all_extensions() returns (at least) what we expect.  As Jeff
Epler suggests in

http://mail.python.org/pipermail/python-dev/2003-September/038264.html

We use a set to test the results.  This fixes the test when
test_urllib2 is run before test_mimetypes.
2003-11-23 16:21:55 +00:00
Raymond Hettinger 49ba4c39c4 * Simplify hash function and add test to show effectiveness of the hash
function.

* Add a better test for deepcopying.

* Add tests to show the __init__() function works like it does for list
  and tuple.  Add related test.

* Have shallow copies of frozensets return self.  Add related test.

* Have frozenset(f) return f if f is already a frozenset. Add related test.

* Beefed-up some existing tests.
2003-11-23 02:49:05 +00:00
Raymond Hettinger bfd334a42d Extend temporary hashability to remove() and discard().
Brings the functionality back in line with sets.py.
2003-11-22 03:55:23 +00:00
Raymond Hettinger 19c2d77842 Allow temporary hashability for the __contains__ test.
(Requested by Alex Martelli.)
2003-11-21 18:36:54 +00:00
Raymond Hettinger 3fbec701ca issubset() and issuperset() to work with general iterables 2003-11-21 07:56:36 +00:00
Guido van Rossum 944a6c32d7 test_applesingle is an expected skip almost anywhere. 2003-11-20 22:11:29 +00:00
Tim Peters 403a203223 SF bug 839548: Bug in type's GC handling causes segfaults.
Also SF patch 843455.

This is a critical bugfix.
I'll backport to 2.3 maint, but not beyond that.  The bugs this fixes
have been there since weakrefs were introduced.
2003-11-20 21:21:46 +00:00
Raymond Hettinger 901dc98316 test_applesingle is an expected skip on Win32 2003-11-20 19:02:02 +00:00
Just van Rossum 5949854200 Fix for [ 765456 ]: testAFakeZlib failed on platforms that use a
statically linked zlib module, but since the problem it tests can't
exist on these systems, simply skip it then. Will backport.
2003-11-18 23:00:55 +00:00
Jack Jansen c0b2b72702 Test the applesingle decoder. 2003-11-18 22:36:12 +00:00
Raymond Hettinger 50a4bb325c Various fixups (most suggested by Armin Rigo). 2003-11-17 16:42:33 +00:00
Raymond Hettinger a690a9967e * Migrate set() and frozenset() from the sandbox.
* Install the unittests, docs, newsitem, include file, and makefile update.
* Exercise the new functions whereever sets.py was being used.

Includes the docs for libfuncs.tex.  Separate docs for the types are
forthcoming.
2003-11-16 16:17:49 +00:00
Tim Peters f7f9e9966b subtype_dealloc(): A more complete fix for critical bug 840829 +
expanded the test case with a piece that needs the more-complete fix.

I'll backport this to 2.3 maint.
2003-11-13 21:59:32 +00:00
Martin v. Löwis d4e48b7f61 Patch #839877: Remove unused lambda expression. 2003-11-13 07:45:39 +00:00
Tim Peters add09b4149 SF bug 840829: weakref callbacks and gc corrupt memory.
subtype_dealloc():  This left the dying object exposed to gc, so that
if cyclic gc triggered during the weakref callback, gc tried to delete
the dying object a second time.  That's a disaster.  subtype_dealloc()
had a (I hope!) unique problem here, as every normal dealloc routine
untracks the object (from gc) before fiddling with weakrefs etc.  But
subtype_dealloc has obscure technical reasons for re-registering the
dying object with gc (already explained in a large comment block at
the bottom of the function).

The fix amounts to simply refraining from reregistering the dying object
with gc until after the weakref callback (if any) has been called.

This is a critical bug (hard to predict, and causes seemingly random
memory corruption when it occurs).  I'll backport it to 2.3 later.
2003-11-12 20:43:28 +00:00
Raymond Hettinger ad983e79d6 Improve the implementation of itertools.tee().
Formerly, underlying queue was implemented in terms of two lists.  The
new queue is a series of singly-linked fixed length lists.

The new implementation runs much faster, supports multi-way tees, and
allows tees of tees without additional memory costs.

The root ideas for this structure were contributed by Andrew Koenig
and Guido van Rossum.
2003-11-12 14:32:26 +00:00
Raymond Hettinger af28e4b66b Update test to handle list.__reversed__(). 2003-11-08 12:39:53 +00:00
Raymond Hettinger b3af1813eb Convert heapq.py to a C implementation. 2003-11-08 10:24:38 +00:00
Martin v. Löwis d2171d2ba4 Overallocate target buffer for normalization more early. Fixes #834676.
Backported to 2.3.
2003-11-06 20:47:57 +00:00
Raymond Hettinger 85c20a41df Implement and apply PEP 322, reverse iteration 2003-11-06 14:06:48 +00:00
Gregory P. Smith a703a21b48 * Use weakref's of DBCursor objects for the iterator cursors to avoid a
memory leak that would've occurred for all iterators that were
  destroyed before having iterated until they raised StopIteration.

* Simplify some code.

* Add new test cases to check for the memleak and ensure that mixing
  iteration with modification of the values for existing keys works.
2003-11-03 01:04:41 +00:00
Gregory P. Smith dc113a8a06 * Fix the singlethreaded deadlocks occurring in the simple bsddb interface.
* Add support for multiple iterator/generator objects at once on the simple
  bsddb _DBWithCursor interface.
2003-11-02 09:10:16 +00:00
Martin v. Löwis 893ffa4372 Patch #830858: Correct the number of is-functions. Backported to 2.3 and 2.2. 2003-10-31 15:35:53 +00:00
Raymond Hettinger c40b7afee2 Update test to include "sorted" in dir(list). 2003-10-29 07:23:57 +00:00
Raymond Hettinger 0a9b9da0c3 Add list.sorted() classmethod. 2003-10-29 06:54:43 +00:00
Armin Rigo 2b3eb4062c Deleting cyclic object comparison.
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
2003-10-28 12:05:48 +00:00
Raymond Hettinger d591f666de Replace the window() example with pairwise() which demonstrates tee(). 2003-10-26 15:34:50 +00:00
Raymond Hettinger f0c5aec85f Minor improvements to itertools.tee():
* tee object is no longer subclassable
* independent iterators renamed to "itertools.tee_iterator"
* fixed doc string typo and added entry in the module doc string
2003-10-26 14:25:56 +00:00
Walter Dörwald 4894c30626 Fix a bug in the memory reallocation code of PyUnicode_TranslateCharmap().
charmaptranslate_makespace() allocated more memory than required for the
next replacement but didn't remember that fact, so memory size was growing
exponentially every time a replacement string is longer that one character.
This fixes SF bug #828737.
2003-10-24 14:25:28 +00:00
Raymond Hettinger 6a5b027742 Added itertools.tee()
It works like the pure python verion except:
* it stops storing data after of the iterators gets deallocated
* the data queue is implemented with two stacks instead of one dictionary.
2003-10-24 08:45:23 +00:00
Martin v. Löwis d4210bc718 Patch #813200: Quote executable path on Windows. Fixes #811082.
Backported to 2.3.
2003-10-23 15:55:28 +00:00
Walter Dörwald f0dfc7ac5c Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
2003-10-20 14:01:56 +00:00
Gustavo Niemeyer ad3fc44ccb Implemented non-recursive SRE matching. 2003-10-17 22:13:16 +00:00
Raymond Hettinger 42b1ba31af * list.sort() now supports three keyword arguments: cmp, key, and reverse.
key provides C support for the decorate-sort-undecorate pattern.
  reverse provide a stable sort of the list with the comparisions reversed.

* Amended the docs to guarantee sort stability.
2003-10-16 03:41:09 +00:00
Brett Cannon 2bfb94c871 Add test__locale to expected skip list for Darwin. 2003-10-13 04:27:47 +00:00
Martin v. Löwis d662548c72 Patch #810914: Return absolute path for mkstemp. Fixes #810408.
This should not be backported to 2.3, as it might break backwards
compatibility.
2003-10-12 17:37:01 +00:00
Brett Cannon 82860df417 see rev. 1.13 for log message 2003-10-12 04:29:10 +00:00
Jeremy Hylton 504de6bd2c Fix for SF bug [ 817156 ] invalid \U escape gives 0=length unistr. 2003-10-06 05:08:26 +00:00
Raymond Hettinger dbe3d280e7 Adopt Christian Stork's suggested argument order for the logic quantifiers.
Adopt Jeremy Fincher's suggested function name, "any", instead of "some".
2003-10-05 16:47:36 +00:00
Raymond Hettinger 2f726e9093 SF bug #812202: randint is always even
* Added C coded getrandbits(k) method that runs in linear time.
* Call the new method from randrange() for ranges >= 2**53.
* Adds a warning for generators not defining getrandbits() whenever they
  have a call to randrange() with too large of a population.
2003-10-05 09:09:15 +00:00
Skip Montanaro dffeed3ffa Make the fieldnames argument optional in the DictReader. If self.fieldnames
is None, the next row read is used as the fieldnames.  In the common case,
this means the programmer doesn't need to know the fieldnames ahead of time.
The first row of the file will be used.  In the uncommon case, this means
the programmer can set the reader's fieldnames attribute to None at any time
and have the next row read as the next set of fieldnames, so a csv file can
contain several "sections", each with different fieldnames.
2003-10-03 14:03:01 +00:00
Raymond Hettinger 3778f40389 Add more identity tests. 2003-09-24 03:56:07 +00:00
Tim Peters b8b60ea0c9 PlaySoundTest.test_alias_nofallback(): Simplified the coding by using
assertRaises.

NOT a bugfix candidate.
2003-09-22 18:41:53 +00:00
Tim Peters 086e56205c PlaySoundTest.test_alias_fallback(): Disabled this test, and explained
why in a new comment.  My home Win98SE box is one of the "real systems"
alluded to (my system "default sound" appears to have vanished sometime
in the last month, that's certainly not a Python bug, and the MS
PlaySound docs are correct in their explanation of what happens then).

Bugfix candidate.  If someone can still sneak it into 2.3.1, that would
be good.
2003-09-22 18:38:53 +00:00
Raymond Hettinger 175a6ac114 Improve and expand identity tests. 2003-09-21 08:14:11 +00:00
Tim Peters 0aab002057 SF patch 809915: Fix bogus address to hopefully always break.
test_bad_address():  Recover from that VeriSign thought it would boost
its corporate coffers to start resolving http://www.sadflkjsasadf.com/.

Bugfix candidate -- although the bug is more VeriSign's than Python's!
2003-09-20 22:16:26 +00:00
Tim Peters c7c516aa51 test__locale (two underscores) can't pass on Windows: RADIXCHAR doesn't
exist, and neither do any of the specific 5-letter locale names the test
is looking for.
2003-09-20 22:06:13 +00:00
Martin v. Löwis c6bb6c0f8c Patch #707167: Pass dircache exceptions to the caller. Fixes #682813.
Not backported because of behaviour change.
2003-09-20 15:52:21 +00:00
Raymond Hettinger 7a70ea4135 SF patch #806246: use basestring where possible
(Contributed by George Yoshida.)
2003-09-17 05:50:59 +00:00
Raymond Hettinger 2d72b5d707 Test __all__ for unittest.py 2003-09-16 04:37:39 +00:00
Raymond Hettinger d55111f791 * Converted test to unittest format.
* Expanded coverage.
2003-09-13 05:51:09 +00:00
Raymond Hettinger 42a61ed277 Simplify doctest of tee(). 2003-09-13 01:01:34 +00:00
Martin v. Löwis 1b699a5f00 Patch #790000: Allow os.access to handle Unicode file name. 2003-09-12 16:25:38 +00:00
Raymond Hettinger deadbf50e4 SF #662923
Add support for the iterator and mapping protocols.
For Py2.3, this was done for shelve, dumbdbm and other mapping objects, but
not for bsddb and dbhash which were inadvertently missed.
2003-09-12 06:33:37 +00:00
Jeremy Hylton b7b1db9191 Oops. Really fix the indentation problem this time. 2003-09-10 20:19:54 +00:00
Jeremy Hylton d7fb676023 Fix inconsistent mix of tabs and spaces that caused test to fail. 2003-09-10 19:57:31 +00:00
Raymond Hettinger a098b33c93 Add an example to address a common question of how to split iterators. 2003-09-08 23:58:40 +00:00
Tim Peters f1827cfaab SF bug 801631: file.truncate fault on windows.
file_truncate():  C doesn't define what fflush(fp) does if fp is open
for update, and the preceding I/O operation on fp was input.  On Windows,
fflush() actually changes the current file position then.  Because
Windows doesn't support ftruncate() directly, this not only caused
Python's file.truncate() to change the file position (contra our docs),
it also caused the file not to change size.

Repaired by getting the initial file position at the start, restoring
it at the end, and tossing all the complicated micro-efficiency checks
trying to avoid "provably unnecessary" seeks.  file.truncate() can't
be a frequent operation, and seeking to the current file position has
got to be cheap anyway.

Bugfix candidate.
2003-09-07 03:30:18 +00:00
Skip Montanaro 3f7a94824e **kwds arg was missing from __init__ for Dict{Reader,Writer} classes.
will backport.
2003-09-06 19:52:12 +00:00
Raymond Hettinger 66d09f1b30 SF bug #801342: Bug (documentation or real, your choice) in random.sample.
random.sample() uses one of two algorithms depending on the ratio of the
sample size to the population size.  One of the algorithms accepted any
iterable population argument so long as it defined __len__().  The other
had a stronger requirement that the population argument be indexable.

While it met the documentation specifications which insisted that the
population argument be a sequence, it made random.sample() less usable
with sets.  So, the second algorithm was modified to coerce non-indexable
iterables and dictionaries into a tuple before proceeding.
2003-09-06 04:25:54 +00:00
Raymond Hettinger b859c070ef SF bug #800796: Difference between hash() and __hash__()
slice(5).__hash__() now raises a TypeError.
2003-09-05 14:27:30 +00:00
Martin v. Löwis f5b93736a2 Patch #798145: Return correct information from nl_langinfo(RADIXCHAR).
Will backport to 2.3.
2003-09-04 18:24:47 +00:00
Raymond Hettinger f70e076042 Only apply case-insensitivity test on appropriate platforms.' test_filecmp.py 2003-09-02 06:59:21 +00:00
Raymond Hettinger eeca37e0b5 SF bug #453515: filecmp.dircmp case sensitivity bug 2003-09-02 05:42:02 +00:00
Raymond Hettinger 5d2e777787 SF patch #736962: Port tests to unittest (Part 2)
(Contributed by Walter Dörwald.)

* Convert test_slice.py to unittest format
* Expand the test coverage.
2003-09-02 01:53:01 +00:00
Raymond Hettinger 6d362b25c5 SF bug #785222: zlib monotonic test
For smaller datasets, it is not always true the increasing the compression
level always results in better compression.  Removed the test which made
this invalid assumption.
2003-08-31 04:35:24 +00:00
Raymond Hettinger f9f4c6945e SF patch #736962: Port tests to unittest
(Contributed by Walter Dörwald).

* Convert three test modules to unittest format.
* Expanded coverage in test_structseq.py.
* Raymond added a new test in test_sets.py
2003-08-30 22:54:55 +00:00
Raymond Hettinger c11dbcd4bf SF bug 797650: Infinite loop in textwrap.py
When the indents were set to longer than the width and long word breaking
was enabled, an infinite loop would result because the inner loop did not
assure that at least one character was stripped off on every pass.
2003-08-30 14:43:55 +00:00
Raymond Hettinger a56f6b6600 SF bug #793826: using itertools.izip to mutate tuples
Avoid Armin Rigo's dastardly exercise in re-entrancy.
2003-08-29 23:09:58 +00:00
Andrew M. Kuchling e8792c1f65 Add tests for meta- bit set 2003-08-29 18:49:05 +00:00
Andrew M. Kuchling e752e20605 Add simple unit test for ascii.unctrl() function 2003-08-29 18:37:37 +00:00
Brett Cannon 953c6f508b Make sure parentheses are escaped when used in the format string.
Closes bug #796149 .  Will be backported.
2003-08-29 02:28:54 +00:00
Raymond Hettinger 9bfe533c69 SF bug #795506: Wrong handling of string format code for float values.
Adding missing support for '%F'.

Will backport to 2.3.1.
2003-08-27 04:55:52 +00:00
Jason Tishler 063606a0d5 test_largefile can leave its temp file open if one of many tests fail. On
platforms (e.g., Cygwin) that are "particular" about open files, this will
cause other regression tests that use the same temp file to fail:

    $ ./python.exe -E -tt Lib/test/regrtest.py -l
    test_largefile test_mmap test_mutants
    test_largefile
    test test_largefile failed -- got -1794967295L, but expected 2500000001L
    test_mmap
    test test_mmap crashed -- exceptions.IOError: [Errno 13] Permission denied: '@test'
    test_mutants
    test test_mutants crashed -- exceptions.IOError: [Errno 13] Permission denied: '@test'

This patch solves the problem by adding missing "try/finally" blocks. Note
that the "large" size of this patch is due to many white space changes --
otherwise, the patch is small.

I tested this patch under Red Hat Linux 8.0 too.
2003-08-26 11:59:27 +00:00
Raymond Hettinger 6a1801271a Improvements to set.py:
* Relaxed the argument restrictions for non-operator methods.  They now
  allow any iterable instead of requiring a set.  This makes the module
  a little easier to use and paves the way for an efficient C
  implementation which can take better advantage of iterable arguments
  while screening out immutables.

* Deprecated Set.update() because it now duplicates Set.union_update()

* Adapted the tests and docs to include the above changes.

* Added more test coverage including testing identities and checking
  to make sure non-restartable generators work as arguments.

Will backport to Py2.3.1 so that the interface remains consistent
across versions.  The deprecation of update() will be changed to
a FutureWarning.
2003-08-17 08:34:09 +00:00
Raymond Hettinger 1954035a47 Keep doctests in sync with the docs. 2003-08-16 00:59:59 +00:00
Walter Dörwald c8cb5d9d69 Make a copy of L before appending, so the global L remains
unchanged (and sys.gettotalrefcount() remains constant).

Fix a few typos.
2003-08-15 17:52:39 +00:00
Michael W. Hudson b2c7de4667 Fix for
[ 784825 ] fix obscure crash in descriptor handling

Should be applied to release23-maint and in all likelyhood
release22-maint, too.

Certainly doesn't apply to release21-maint.
2003-08-15 13:07:47 +00:00
Andrew M. Kuchling 69f31eb80c [Patch #739124] Add use_default_colors() to curses module 2003-08-13 23:11:04 +00:00
Walter Dörwald a54b92b2eb Add a unicode prefix to the characters in the UnicodeEncodeError and
UnicodeTranslateError message.
2003-08-12 17:34:49 +00:00
Walter Dörwald fd196bd263 Enhance message for UnicodeEncodeError and UnicodeTranslateError.
If there is only one bad character it will now be printed in a
form that is a valid Python string.
2003-08-12 17:32:43 +00:00
Brett Cannon c83124ab79 Fix bug in test_bad_timezone where test was assuming locale knew of PDT. 2003-08-11 19:06:13 +00:00
Jason Tishler 0fd54d8050 Unconditionally opening the temp file in text mode causes this test to fail
under Cygwin. The attached patch corrects this problem.

I tested this patch under Red Hat Linux 8.0 too.
2003-08-11 12:13:14 +00:00
Brett Cannon 5187a3bcdb Fix handling of bad locale setup where time.tzname[0] == time.tzname[1] and
time.daylight is true.  Add an explicit test for this situation.

Fixed some wording in docstrings.
2003-08-11 07:24:05 +00:00
Raymond Hettinger 3081d59f92 SF bug #778964: bad seed in python 2.3 random
The default seed is time.time().
Multiplied by 256 before truncating so that fractional seconds are used.
This way, two successive calls to random.seed() are much more likely
to produce different sequences.
2003-08-09 18:30:57 +00:00
Raymond Hettinger 5475f2394a SF bug #770485: cStringIO does not set closed attr 2003-08-08 12:20:03 +00:00
Raymond Hettinger b5a420883c Modified itertools.izip() to match the behavior of __builtin__.zip()
which can now take zero arguments.
2003-08-08 05:10:41 +00:00
Raymond Hettinger 77fe69bd08 Re-sync doc tests with the doc updates. 2003-08-08 04:33:19 +00:00
Michael W. Hudson e723e453a1 Repair refcounting on error return from type_set_bases.
Include a test case that failed for one of my efforts to repair this.
2003-08-07 14:58:10 +00:00
Mark Hammond 7edd0a9b21 Demonstrate and fix [ 783882 ] os.lstat crashes with Unicode filename.
Will also check in on the 2.3 branch.
2003-08-06 02:46:58 +00:00
Walter Dörwald 5301d9c10d Remove useless import. 2003-08-05 15:55:38 +00:00
Walter Dörwald b27cca6634 Check both __div__ and __truediv__ in division tests.
(From SF patch #543867)
2003-08-05 15:34:34 +00:00
Martin v. Löwis 0d8e16c7ad Support trailing dots in DNS names. Fixes #782510. Will backport to 2.3. 2003-08-05 06:19:47 +00:00
Martin v. Löwis 8db4403a76 Correct URL of normalization file. Fixes #781065. Will backport to 2.3. 2003-08-05 05:59:13 +00:00
Brett Cannon 474335ce17 Re-introduce caching of TimeRE and compiled regexes with added thread-safety.
Also remove now unnecessary property attributes for thread safety
(no longer have lazy attributes) and code simplicity reasons.

Timezone storage has been reworked to be simpler and more flexible.  All values
in LocaleTime instances are lower-cased.  This is all done to simplify the
module.

The module now assumes nothing beyond the strptime function will be exposed for
general use beyond providing functionality for strptime.
2003-08-05 04:02:49 +00:00
Skip Montanaro ed9bf12848 protect against test problems with Jython 2003-08-03 23:30:40 +00:00
Skip Montanaro d5cf0b86df added test for bug 782369 2003-08-03 23:02:10 +00:00
Skip Montanaro c1b4154587 more extension marshal tests and conversion to unittest - was surprised to
see how much of the file was not covered by the build process
2003-08-02 15:02:33 +00:00
Raymond Hettinger eaef615116 As discussed on python-dev, changed builtin.zip() to handle zero arguments
by returning an empty list instead of raising a TypeError.
2003-08-02 07:42:57 +00:00
Brett Cannon 175ddb5b30 Remove caching of TimeRE (and thus LocaleTime) instance. Error was being
caught when executing test_strptime, test_logging, and test_time in that order
when the testing of "%c" occured.  Suspect the cache was not being recreated
(the test passed when test_logging was forced to re-establish the locale).
2003-07-24 06:27:17 +00:00
Tim Peters 5943b4ac10 Restored commented-out line checked in by mistake. 2003-07-23 00:30:39 +00:00
Tim Peters 9390dd5b4a locale-restoration code: Don't leave comparison to None implicit. For
all I know, the original locale may be '' (I don't think that's possible,
but ...), and if so we would certainly want to restore it.
2003-07-23 00:30:11 +00:00
Tim Peters 36f7e938f2 Fred wasn't kidding -- there really are docs for the locale module <wink>.
Obtain the original locale in the documented way.  This way actually
works for me.

Restore the original locale at the end, instead of forcing to "C".

Move the locale fiddling into the test driver instead of doing it as a
side effect of merely importing the module.  I don't know why the test
is mucking with locale (and also added a comment saying so), but it
surely has no justification for doing that as an import side-effect.
Now whenever the locale-changing code executes, the locale-restoring code
will also get run.
2003-07-23 00:05:07 +00:00
Brett Cannon d1deac06e7 Fix error in test of not comparing against 0 item of a list 2003-07-22 21:07:16 +00:00
Jason Tishler c23f39ca9d Patch #775784: YA Cygwin expected regression test skip patch
This patch just adds test_ioctl to the list of expected skips for Cygwin.
2003-07-22 18:35:58 +00:00
Thomas Heller 354e3d90d3 Change the zipimport implementation to accept files containing
arbitrary bytes before the actual zip compatible archive.  Zipfiles
containing comments at the end of the file are still not supported.

Add a testcase to test_zipimport, and update NEWS.

This closes sf #775637 and sf #669036.
2003-07-22 18:10:15 +00:00
Jeremy Hylton 969a7003f9 Make sure mimetypes is reinitialized before running the tests.
If some other test comes along and uses mimetypes, it will be
initialized from the system files.
2003-07-18 15:13:37 +00:00
Jeremy Hylton 096d986f3b Restore the locale to "C" on exit.
If this doesn't happen, it leaves the locale in a state that can cause
other tests to fail.  For example, running test_strptime,
test_logging, and test_time in that order.
2003-07-18 03:19:20 +00:00
Jeremy Hylton bd9f520907 Reflow long line. 2003-07-17 16:31:00 +00:00
Raymond Hettinger 43d790c087 Exercise Jim Fulton's new doctest extension for running doctests in a
unittest environment.  Since his extension finds docstrings in private
functions, it exposed a bug in the difflib doctests.
2003-07-16 04:34:56 +00:00
Raymond Hettinger f3590623e9 Extend last change to cover TestSuites as well as TestCases. 2003-07-16 04:29:42 +00:00
Mark Hammond bb4a47c818 Prevent failure on the mac, where "mbcs" is not the file system
encoding.  Use sys.getfilesystemencoding().
2003-07-16 03:46:38 +00:00
Raymond Hettinger 21d9987cb5 run_unittest() to support TestCase instances as well as classes. Helps with doctests. 2003-07-16 02:59:32 +00:00
Raymond Hettinger 19db13bcc7 Fixed test and converted to unittest format.
Checking // would call floor division but did not test that
true division had become the default with 'from __future__ import division'.
2003-07-15 21:03:13 +00:00
Raymond Hettinger 158af581ae Fixed test and converted to unittest format.
Checking // would call floor division but did not test that
true division had become the default with 'from __future__ import division'.
2003-07-15 20:57:35 +00:00
Jeremy Hylton 42d90161e2 SF patch 763201: handling of SyntaxErrors in symbol table build
Bug fix candidate.
2003-07-15 20:24:27 +00:00
Walter Dörwald f393fc6e51 Add various test cases from SF patch 543867. 2003-07-15 18:47:27 +00:00
Fred Drake f425b1ec42 stylistic nits:
- wrap some long lines
- shorten others
- fix indentation
2003-07-14 21:37:17 +00:00
Tim Peters 7a6c733c3b Make close() identical to __del__() for a dumbdbm database. Make
closing idempotent (it used to raise a nuisance exception on the 2nd
close attempt).

Bugfix candidate?  Probably, but arguable.
2003-07-13 17:21:10 +00:00
Raymond Hettinger d6f6e50c9b Reworked test_warnings.py:
* It ran fine under "python regrtest.py test_warnings" but failed under
  "python regrtest.py" presumably because other tests would add to
  filtered warnings and not reset them at the end of the test.

* Converted to a unittest format for better control.  Renamed
  monkey() and unmonkey() to setUp() and tearDown().

* Increased coverage by testing all warnings in __builtin__.

* Increased coverage by testing regex matching of specific messages.
2003-07-13 08:37:40 +00:00
Raymond Hettinger dc9dcf135e This test failed on WindowsME because the full file path did not get
reported consistently with the *nix world.  'Lib/test/test_warnings.py'
came out as 'lib\test\test_warnings.py'.  The basename is all we care
about so I used that.
2003-07-13 06:15:11 +00:00
Jeremy Hylton b6d2f3e07d Don't include slash in search string; it's OS-specific. 2003-07-11 20:22:55 +00:00
Jeremy Hylton 8501466c7f Change warnings to avoid importing re module during startup.
Add API function simplefilter() that does not create or install
regular expressions to match message or module.  Extend the filters
data structure to store None as an alternative to re.compile("").

Move the _test() function to test_warnings and add some code to try
and avoid disturbing the global state of the warnings module.
2003-07-11 15:37:59 +00:00
Tim Peters 663d1b61cb Added a new randomized test. 2003-07-11 04:09:09 +00:00
Jeremy Hylton 121d34af19 Fix SF bug 764095: Don't use network in test_httplib. 2003-07-08 12:36:58 +00:00
Tim Peters e5e065b669 New function sys.getcheckinterval(), to complement setcheckinterval(). 2003-07-06 18:36:54 +00:00
Brett Cannon cde2200ff2 Fixes bug of timezone value being left as -1 when ``time.tzname[0] ==
time.tzname[1] and not time.daylight`` is true when it should only when
time.daylight is true.  Tests are also fixed.

Closes bug #763047 and its cohort #763052.
2003-07-03 19:59:57 +00:00
Just van Rossum 12723bacea Fix and test for bug #764548:
Use isinstance() instead of comparing types directly, to enable
subclasses of str and unicode to be used as patterns.
Blessed by /F.
2003-07-02 20:03:04 +00:00
Just van Rossum 6802c6e764 fixed typo in comment 2003-07-02 14:36:59 +00:00
Andrew MacIntyre 348c261fe6 On those systems lacking the AFMT_S16_NE symbol, the test was failing
because it was still looking in the ossaudiodev module namespace for
this symbol.

As the symbol has already been rebound as a global, use that instead.
2003-07-02 14:05:08 +00:00
Just van Rossum bcc58e87e8 - added (c)StringIO tests; cStringIO usage failed in the previous
version of plistlib.py (r1.2)
2003-07-01 20:22:30 +00:00
Neal Norwitz e7dfe21bed Fix SF bug #763023, difflib.py: ratio() zero division not caught
Backport candidate
2003-07-01 14:59:46 +00:00
Tim Peters 37ca8c12dc connector(): You can't use an empty string as an argument to connect()
on Windows.
2003-07-01 14:49:32 +00:00
Neal Norwitz 1787a0b1cc Fix SF bug #763770, test_socket_ssl crash
Don't run any tests if there is no ssl support.
2003-07-01 13:44:28 +00:00
Raymond Hettinger cc0a664669 Test Brett's addition of __all__ to Queue. 2003-07-01 05:49:02 +00:00
Neal Norwitz 168e73d25e Fix SF #763362, test_posixpath failed
Don't check expanduser('~') if the home directory == the root directory
(ie, we are running as root).
2003-07-01 03:33:31 +00:00
Neal Norwitz 3106817c68 Fix typo in error message 2003-06-30 19:22:12 +00:00
Walter Dörwald 8bcbe6aa7e Don't require that a RuntimeError is raised when playing a second
sound while the first one is still running, as the first one
one might already have finished.

Fixes part of SF bug #763052.
2003-06-30 11:57:52 +00:00
Raymond Hettinger d693a81595 Fix SF 762891: "del p[key]" on proxy object raises SystemError() 2003-06-30 04:18:48 +00:00
Neal Norwitz a9002f824b Fix SF #754870, SSL crash interpreter when remote side closes during connect
Also fix a memory leak.
2003-06-30 03:25:20 +00:00
Raymond Hettinger 0242070d04 More tests
* Test with infinite inputs (using take() on the output)
* Test whether GC can find and eliminate cycles.
2003-06-29 20:36:23 +00:00
Raymond Hettinger b4e9986782 Removed invalid test.
Analysis by Bob Halley:

  The test seems to expect that if time.daylight is true, then the
  is_dst field of the tm structure will be 1 too.  But this isn't
  the case, since daylight is true if the timezone does DST, *not*
  if DST is in effect.
2003-06-29 15:57:50 +00:00
Raymond Hettinger 2b6220d88b SF bug #762455: Python segfaults when sys.stdout is changed in getattr
* Added unittest that fails before, but not after Neil's fix to ceval.c.
2003-06-29 15:44:07 +00:00
Tim Peters 478c10554b Whitespace normalization. 2003-06-29 05:46:54 +00:00
Raymond Hettinger 11a35f545b SF patch #760257: add socket.timeout exception
(Contributed by Bob Halley)

Add unittests for the new socket.timeout exception.
2003-06-29 04:40:22 +00:00
Raymond Hettinger 3567a876c7 Add take() to examples. Tighten the islice() example 2003-06-28 05:44:36 +00:00
Raymond Hettinger c0fac96c29 SF patch #756996: Bare except in ZipFile.testzip()
(Contributed by Steven Taschuk)

Replaces a bare except that caused all errors to be mis-reported as
archive errors.

Added a related NEWS item.
2003-06-27 22:25:03 +00:00
Raymond Hettinger 6f3eaa67e5 SF patch #761519: Fixes for bugs 760703 and 757821
SF bug #760703: SocketHandler and LogRecord don't work well together
SF bug #757821: logging module docs

Applied Vinay Sajip's patch with a few minor fixups and a NEWS item.

Patched __init__.py - added new function
makeLogRecord (for bug report 760703).

Patched handlers.py - updated some docstrings and
deleted some old commented-out code.

Patched test_logging.py to make use of makeLogRecord.

Patched liblogging.tex to fill documentation gaps (both
760703 and bug 757821).
2003-06-27 21:43:39 +00:00
Jeremy Hylton c4bf5edc3a Add a trivial test of getargspec() with a method. 2003-06-27 18:43:12 +00:00
Jeremy Hylton 7ff55e6bc5 Add tests for __nonzero__() problems. 2003-06-27 17:40:16 +00:00
Raymond Hettinger f69d9f6818 SF bug #761337: datetime.strftime fails on trivial format string
The interning of short strings violates the refcnt==1 assumption for
_PyString_Resize().

A simple fix is to boost the initial value of "totalnew" by 1.
Combined with an NULL argument to PyString_FromStringAndSize(),
this assures that resulting format string is not interned.
This will remain true even if the implementation of
PyString_FromStringAndSize() changes because only the uninitialized
strings that can be interned are those of zero length.

Added a test case.
2003-06-27 08:14:17 +00:00
Raymond Hettinger 5f078ff7f0 SF bug #759889: Pickling of Random is broken
* Implement __reduce__() to support pickling.
* Add a test case to prove a successful roundtrip through pickle.
2003-06-24 20:29:04 +00:00
Raymond Hettinger 8a99b50239 SF patch #736962. Converted test_compile to unittest format. 2003-06-23 13:36:57 +00:00
Raymond Hettinger 4327521688 Added regression test for SF #757818 2003-06-20 18:41:26 +00:00
Gustavo Niemeyer 25fe0bf91a Many new tests, based on gcov's coverage information.
From gcov's output (based on a locally changed _sre.c):

  82.07% of 1372 source lines executed in file ./Modules/_sre.c
2003-06-20 00:25:14 +00:00
Walter Dörwald a9da5ae07a Use find() instead of looping over the string in expanduser().
From SF patch #757058.
2003-06-19 10:21:14 +00:00
Raymond Hettinger befa37dd05 Minor updates:
* Updated comment on design of imap()
* Added untraversed object in izip() structure
* Replaced the pairwise() example with a more general window() example
2003-06-18 19:25:37 +00:00
Walter Dörwald 5edd785bbb Port test_complex.py to unittest.
Move the constructor tests from test_builtin to test_complex.

Add a bunch of tests (code coverage is a 94%).

From SF patch #736962.
2003-06-18 14:26:18 +00:00
Raymond Hettinger be9715398b SF bug #753451: classmethod abuse --> SystemError
Check the argument to classmethod for callability.

Backport candidate.
2003-06-18 01:13:41 +00:00
Walter Dörwald e8049befdf Use _PyEval_SliceIndex to handle list.index() calls with
huge start and stop arguments. Add tests.
2003-06-17 19:27:39 +00:00
Guido van Rossum 2743d87d79 Fix sloppy index() implementation:
- don't use min() and max()
- interpret negative start/stop argument like negative slice indices
2003-06-17 14:25:14 +00:00
Raymond Hettinger d05abdec7b SF #754014: list.index() should accept optional start, end arguments
Also, modified UserList.index() to match and expanded the related tests.
2003-06-17 05:05:49 +00:00
Raymond Hettinger c8106e1f1d test_posixpath.py now uses unittest. The output file is no longer needed. 2003-06-17 04:19:59 +00:00
Neal Norwitz 98a379eda1 Add test for bug #751998. 2003-06-16 22:51:22 +00:00
Brett Cannon b47243ae45 Complete rewrite of tests by Walter Dorwald as unittest tests. 2003-06-16 21:54:50 +00:00
Tim Peters f545baa0cc Whitespace normalization. 2003-06-15 23:26:30 +00:00
Martin v. Löwis 17fb50790d Treat empty dat/dir pairs as dumbdbm. Fixes #744687. 2003-06-14 08:16:34 +00:00
Martin v. Löwis ba8f5ff76c Copy builtin functions as atomic. Fixes #746304. Will backport to 2.2. 2003-06-14 07:10:06 +00:00
Brett Cannon 91012fe9b5 Cause calling interrupt_main in main thread raise KeyboardInterrupt instantly. 2003-06-13 23:56:32 +00:00
Brett Cannon 4e64d78bbb dummy_thread modified to have interrupt_main and to behave appropriately when
called.

Added announcement in Misc/NEWS for thread.interrupt_main and mention of
dummy_thread's change.
2003-06-13 23:44:35 +00:00
Guido van Rossum 99d2c251df SF patch 707900, fixing bug 702858, by Steven Taschuk.
Copying a new-style class that had a reference to itself didn't work.
(The same thing worked fine for old-style classes.)
2003-06-13 19:28:47 +00:00
Brett Cannon 43e559a155 When calling tarname with an argument (and thus not use testtar.tar) return a
path for the file in the temp directory for the platform.
2003-06-12 19:16:58 +00:00
Brett Cannon 455ea53d0e Make creation of temporary file and directory more portable. Also made cleanup
code use proper functions to get paths.

Changed the name of tar file that is searched for to be absolute (i.e., not use
os.extsep) since filename is locked in based on name of file in CVS
(testtar.tar).

Closes bug #731403 .
2003-06-12 08:01:06 +00:00
Skip Montanaro 1546bc43fe add a couple test cases which involve longs and floats in 'e' format. 2003-06-12 02:40:22 +00:00
Barry Warsaw 9caa0d1642 guess_all_extensions(): Return the empty list instead of None when
there are no matching types.  Updated the docs and docstrings.  Added
some unit tests.
2003-06-09 22:27:41 +00:00
Neal Norwitz e2fdc61004 Fix SF #749831, copy raises SystemError when getstate raises exception 2003-06-08 13:19:58 +00:00
Martin v. Löwis 56f88113b7 Patch #746801: FreeBSD 4 expected failures, by Charles Swiger. 2003-06-07 20:01:37 +00:00
Greg Ward 8a709b3049 Factor endian-ness check out of play_sound_file(), and fix
test_setparameters() to use it -- don't assume AFMT_S16_NE is always
defined!
2003-06-03 00:32:44 +00:00
Raymond Hettinger 40174c358f SF bug #733667: kwargs handled incorrectly
The fast_function() inlining optimization only
applies when there are zero keyword arguments.
2003-05-31 07:04:16 +00:00
Guido van Rossum bb1861a996 Remove debug code from weakref_segfault(). 2003-05-29 14:30:49 +00:00
Guido van Rossum aabe0b3e34 Add testcase for SF 742911. 2003-05-29 14:26:57 +00:00
Raymond Hettinger b25a52aac0 Fix typo so that the test actually calls the tested function. 2003-05-29 07:20:29 +00:00
Raymond Hettinger f0fa1c03a0 Test ability to handle various type of iterators. 2003-05-29 07:18:57 +00:00
Greg Ward 29a1deff3a Test script changed. 2003-05-29 01:29:28 +00:00
Greg Ward 4f12d4652d Renamed test_errors() to test_setparameters() and completely rewrote it
to test the new setparameters() interface.

Modified play_sound_file() to print the elapsed time taken to play the
test sample (to the nearest 0.1 sec).
2003-05-29 01:27:39 +00:00
Greg Ward 080c110172 Order and number of arguments to setparameters() has changed.
Rename 'a' (the audio device) to 'dsp' everywhere.
2003-05-29 00:23:17 +00:00
Raymond Hettinger e8b0f0461b * Beefed-up tests
* Allow tuple re-use
* Call tp_iternext directly
2003-05-28 14:05:34 +00:00
Jeremy Hylton 893801efb6 Add more tests from RFC 2202. 2003-05-27 16:16:41 +00:00
Tim Peters 50d8b8b6ae Fleshed out WeakKeyDictionary.__delitem__ NEWS to cover issues raised on
Python-Dev.  Fixed typos in test comments.  Added some trivial new test
guts to show the parallelism (now) among __delitem__, __setitem__ and
__getitem__ wrt error conditions.

Still a bugfix candidate for 2.2.3 final, but waiting for Fred to get a
chance to chime in.
2003-05-25 17:44:31 +00:00
Tim Peters 886128f4f8 SF 742860: WeakKeyDictionary __delitem__ uses iterkeys
Someone review this, please!  Final releases are getting close, Fred
(the weakref guy) won't be around until Tuesday, and the pre-patch
code can indeed raise spurious RuntimeErrors in the presence of
threads or mutating comparison functions.

See the bug report for my confusions:  I can't see any reason for why
__delitem__ iterated over the keys.  The new one-liner implementation
is much faster, can't raise RuntimeError, and should be better-behaved
in all respects wrt threads.

New tests test_weak_keyed_bad_delitem and
test_weak_keyed_cascading_deletes fail before this patch.

Bugfix candidate for 2.2.3 too, if someone else agrees with this patch.
2003-05-25 01:45:11 +00:00
Tim Peters e87568dd9a SF bug 705231: Assertion failed, python aborts.
float_pow():  Don't let the platform pow() raise -1.0 to an integer power
anymore; at least glibc gets it wrong in some cases.  Note that
math.pow() will continue to deliver wrong (but platform-native) results
in such cases.
2003-05-24 20:18:24 +00:00
Walter Dörwald 8891021229 Port test_mimetools.py to PyUnit and add various tests.
From SF patch #736962.
2003-05-22 17:32:40 +00:00
Neal Norwitz 35c6cd0905 Walter's last checkin also needs to work on doubles.
* Move new test_byteswap into FPTest.
 * Remove extra lines at end of file.
2003-05-22 13:29:15 +00:00
Walter Dörwald cf99b0afb6 test_byteswap() fails on alphas, because treating the byte swapped bit
patterns as floats/doubles results in floating point exceptions.

Fix this by implementing a separate test_byteswap() for the floating
point tests. This new test compares the tostring() values of both arrays
instead of the arrays themselves.

Discovered by Neal Norwitz.
2003-05-22 13:15:31 +00:00
Jeremy Hylton 4d508adae3 Fix for SF [ 734869 ] Lambda functions in list comprehensions
The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module.  Repair by move tmpname into the symtable entry.

Bugfix candidate.
2003-05-21 17:34:50 +00:00
Barry Warsaw e960e22579 Added a test for the fix of SF bug #658233, where continuation lines
in .po metadata caused a crash.

Also, removed some unnecessary code.

Backport candidate.
2003-05-20 17:28:54 +00:00
Skip Montanaro 7789237331 * Correct Sniffer doc to correspond to the implementation.
* Add optional delimiters arg to Sniffer.sniff() which restricts the set of
  candidate field delimiters.
2003-05-19 15:33:36 +00:00
Martin v. Löwis 9a3a9f7791 Consider \U-escapes in raw-unicode-escape. Fixes #444514. 2003-05-18 12:31:09 +00:00
Walter Dörwald 9e46abed50 Fix array.array.insert(), so that it treats negative indices as
being relative to the end of the array, just like list.insert() does.
This closes SF bug #739313.
2003-05-18 03:15:10 +00:00
Walter Dörwald ba39d9c168 Add another error case to the insert test. 2003-05-18 01:56:25 +00:00
Walter Dörwald 7fd9424230 Port test_array and test_winsound to PyUnit. Enhance tests for array
(code coverage for Modules/arraymodule.c is at 91%)

From SF patch #736962.
2003-05-18 00:47:47 +00:00
Raymond Hettinger 74e67661a6 User cStringIO instead of StringIO. 2003-05-17 20:44:12 +00:00
Tim Peters b0c854d6a7 datetime.timedelta is now subclassable in Python. The new test shows
one good use:  a subclass adding a method to express the duration as
a number of hours (or minutes, or whatever else you want to add).  The
native breakdown into days+seconds+us is often clumsy.  Incidentally
moved a large chunk of object-initialization code closer to the top of
the file, to avoid worse forward-reference trickery.
2003-05-17 15:57:00 +00:00
Samuele Pedroni 72c5c77ce1 minor fix, jython-only. Don't asssume stdout to save is the ur-stdout. 2003-05-17 12:51:10 +00:00
Tim Peters a98924a063 datetime.datetime and datetime.time can now be subclassed in Python. Brr. 2003-05-17 05:55:19 +00:00
Skip Montanaro ab0053aa13 simpler temp dir cleanup 2003-05-17 02:54:11 +00:00
Samuele Pedroni de9a0d3158 beefed up version: jython support, covers now fixed differences between CPython/Jython. 2003-05-17 02:39:52 +00:00
Tim Peters eb1a496039 test_subclass_date(): Beefed this up, to check that new instance
attributes and methods work, that new arguments can be passed to the
constructor, and that inherited methods and attrs still work.  Added
XXX comments about what to do when datetime becomes usably subclassable
too (it's not yet).
2003-05-17 02:25:20 +00:00
Raymond Hettinger 1ba24b4fbb Include module name in doctest summary. 2003-05-17 01:59:57 +00:00
Raymond Hettinger 627728acbc Use test_support.run_doctest() 2003-05-17 01:08:35 +00:00
Raymond Hettinger 35b34bd326 Provide a clue that the doctests have run. 2003-05-17 00:58:33 +00:00
Raymond Hettinger 929f06c570 Minor cleanups. 2003-05-16 23:16:36 +00:00
Tim Peters 813cec9a62 test_fileno(): Skip this test on Windows. 2003-05-16 15:35:10 +00:00
Brett Cannon a71319eebb Fleshed out tests for urllib requiring a network connection. 2003-05-14 02:18:31 +00:00
Brett Cannon 065f7b8626 Fixed test_anydbm_creates to use proper paths for the created db.
Made some stylistic fixes.
2003-05-13 06:42:59 +00:00
Tim Peters c2659cff5d Whitespace normalization. 2003-05-12 20:19:37 +00:00
Tim Peters 0ff2ee0561 Effectively renamed tokenize_tests.py to have a txt extension instead.
This file isn't meant to be executed, it's data input for test_tokenize.py.
The problem with the .py extension is that it uses "non-standard"
indentation, and it's good to test that, but reindent.py keeps wanting
to fix it.  But fixing the indentation causes the expected-output file to
change, since exact line and column numbers are part of the
tokenize.tokenize() output getting tested.
2003-05-12 19:42:04 +00:00
Tim Peters 11cb813598 Close the file after tokenizing it. Because the open file object was
bound to a module global, the file object remained opened throughout
the test suite run.
2003-05-12 19:29:36 +00:00
Brett Cannon 172d9ef47e Beefed up timezone support. UTC and GMT are now always recognized timezones
with values of 0.  Also now check time.daylight to see if time.tzname[1]
should be used in timezone checking.
2003-05-11 06:23:36 +00:00
Martin v. Löwis a94568a753 Patch #734231: Update RiscOS support. In particular, correct
riscospath.extsep, and use os.extsep throughout.
2003-05-10 07:36:56 +00:00
Raymond Hettinger b7b4ce27f7 All two more modules with __all__. 2003-05-10 05:37:13 +00:00
Greg Ward 9e082f4eae Add DedentTestCase to test dedent() function. 2003-05-08 01:58:26 +00:00
Raymond Hettinger 686b14d7ad SF bug #730296: Unexpected Changes in list Iterator
Reverted a Py2.3b1 change to iterator in subclasses of list and tuple.
They had been changed to use __getitem__ whenever it had been overriden
in the subclass.

This caused some usabilty and performance problems.  Also, it was
inconsistent with the rest of python where many container methods
access the underlying object directly without first checking for
an overridden getter.  Users needing a change in iterator behavior
should override it directly.
2003-05-07 01:28:47 +00:00
Greg Ward cc55cb9539 SF #596434: add test_funky_parens() to probe some more of the tricky
edge cases that David Goodger reported long ago (July 2002?).
2003-05-07 01:19:22 +00:00
Greg Ward 49128575e8 SF #726446: ensure wrap() raises ValueError when width <= 0. 2003-05-07 00:54:42 +00:00
Skip Montanaro 6967f2c2e9 don't need to worry about file endianness 2003-05-06 20:37:56 +00:00
Skip Montanaro f0776d2992 Data file for bsddb185 test 2003-05-06 20:37:25 +00:00
Skip Montanaro 46f4e79aaf test case for bsddb185 module 2003-05-06 20:36:57 +00:00
Skip Montanaro 823ba28b0d the new bsddb185 module is an expected skip on most platforms (this may not
be needed - just being anal)
2003-05-06 20:36:24 +00:00
Skip Montanaro 1a56665e39 add not-yet-supported Unicode test just so it doesn't get lost. 2003-05-06 15:56:05 +00:00
Walter Dörwald 411e5a2c29 Port test_uu.py to PyUnit. From SF patch #662807. 2003-05-06 08:57:41 +00:00
Walter Dörwald ce6829ade0 On Mac OS X pwd.getpwall() might return the tuples
('pgsql', '*', 252, []) and ('postgres', '*', 252, ['skip']),
but pwd.getgrgid(252) might return ('pgsql', '', 252, ['skip']).

Drop the test that tried to find a tuple similar to the one
returned from pwd.getgrgid() among those for the same gid returned
by pwd.getgrall(), as the only working definition of 'similar' seems
to be 'has the same gid'. This check can be done more directly.

This should fix SF bug #732783.
2003-05-05 20:37:33 +00:00