Commit Graph

3941 Commits

Author SHA1 Message Date
Andrew Dalke 725fe4089d Test for more edge strip cases; leading and trailing separator gets removed
even with strip(..., 0)
2006-05-26 16:22:52 +00:00
Tim Peters 02494764cb Explicitly close files. I'm trying to stop the frequent spurious test_tarfile
failures on Windows buildbots, but it's hard to know how since the regrtest
failure output is useless here, and it never fails when a buildbot slave runs
test_tarfile the second time in verbose mode.
2006-05-26 14:02:05 +00:00
Tim Peters b1f3251ceb Use open() to open files (was using file()). 2006-05-26 13:39:17 +00:00
Bob Ippolito e27337b5d0 fix #1229380 No struct.pack exception for some out of range integers 2006-05-26 13:15:44 +00:00
Andrew Dalke 669fa188b1 Added more rstrip tests, including for prealloc'ed arrays 2006-05-26 13:05:55 +00:00
Andrew Dalke 5cc6009f0d Test cases for off-by-one errors in string split with multicharacter pattern. 2006-05-26 12:31:00 +00:00
Andrew Dalke 005aee2c39 I like tests.
The new split functions use a preallocated list.  Added tests which exceed
the preallocation size, to exercise list appends/resizes.

Also added more edge case tests.
2006-05-26 12:28:15 +00:00
Tim Peters fe98f9613b Whitespace normalization. 2006-05-26 12:26:21 +00:00
Martin Blais 2856e5f390 Support for buffer protocol for socket and struct.
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
  protocol (send and sendto already did).

* Added struct.pack_to(), that is the corresponding buffer compatible method to
  unpack_from().

* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Andrew Dalke 03fb444990 Added split whitespace checks for characters other than space. 2006-05-26 11:15:22 +00:00
Andrew Dalke 984b971341 Added a few more test cases for whitespace split. These strings have leading whitespace. 2006-05-26 11:11:38 +00:00
Fredrik Lundh 06a69dd8ff needforspeed: partition implementation, part two.
feel free to improve the documentation and the docstrings.
2006-05-26 08:54:28 +00:00
Tim Peters d95d593f47 Whitespace normalization. 2006-05-25 21:52:19 +00:00
Brett Cannon 36850456ca Change test_values so that it compares the lowercasing of group names since getgrall() can return all lowercase names while getgrgid() returns proper casing.
Discovered on Ubuntu 5.04 (custom).
2006-05-25 21:33:11 +00:00
Fredrik Lundh 0c71f88fc9 needforspeed: check for overflow in replace (from Andrew Dalke) 2006-05-25 16:46:54 +00:00
Andrew Dalke 2bddcbf10e Added tests for implementation error we came up with in the need for speed sprint. 2006-05-25 16:30:52 +00:00
Thomas Wouters 143bdfcee6 Update graminit.c for the fix for #1488915, Multiple dots in relative import
statement raise SyntaxError, and add testcase.
2006-05-25 11:26:25 +00:00
Tim Peters 696cf43b58 Heavily fiddled variant of patch #1442927: PyLong_FromString optimization.
``long(str, base)`` is now up to 6x faster for non-power-of-2 bases.  The
largest speedup is for inputs with about 1000 decimal digits.  Conversion
from non-power-of-2 bases remains quadratic-time in the number of input
digits (it was and remains linear-time for bases 2, 4, 8, 16 and 32).

Speedups at various lengths for decimal inputs, comparing 2.4.3 with
current trunk.  Note that it's actually a bit slower for 1-digit strings:

  len  speedup
 ----  -------
   1     -4.5%
   2      4.6%
   3      8.3%
   4     12.7%
   5     16.9%
   6     28.6%
   7     35.5%
   8     44.3%
   9     46.6%
  10     55.3%
  11     65.7%
  12     77.7%
  13     73.4%
  14     75.3%
  15     85.2%
  16    103.0%
  17     95.1%
  18    112.8%
  19    117.9%
  20    128.3%
  30    174.5%
  40    209.3%
  50    236.3%
  60    254.3%
  70    262.9%
  80    295.8%
  90    297.3%
 100    324.5%
 200    374.6%
 300    403.1%
 400    391.1%
 500    388.7%
 600    440.6%
 700    468.7%
 800    498.0%
 900    507.2%
1000    501.2%
2000    450.2%
3000    463.2%
4000    452.5%
5000    440.6%
6000    439.6%
7000    424.8%
8000    418.1%
9000    417.7%
2006-05-24 21:10:40 +00:00
Tim Peters f4049089c5 Disable the damn empty-string replace test -- it can't
be make to pass now for unicode if it passes for str, or
vice versa.
2006-05-24 21:00:45 +00:00
Tim Peters beaec0c3a1 We can't leave the checked-in tests broken. 2006-05-24 20:27:18 +00:00
Andrew Dalke e5488ec01e Added a slew of test for string replace, based various corner cases from
the Need For Speed sprint coding.  Includes commented out overflow tests
which will be uncommented once the code is fixed.

This test will break the 8-bit string tests because
    "".replace("", "A") == "" when it should == "A"

We have a fix for it, which should be added tomorrow.
2006-05-24 18:55:37 +00:00
Bob Ippolito eb62127842 refactor unpack, add unpack_from 2006-05-24 15:32:06 +00:00
Tim Peters 1bddfb84ee test_struct grew weird behavior under regrtest.py -R,
due to a module-level cache.  Clearing the cache should
make it stop showing up in refleak reports.
2006-05-23 21:51:35 +00:00
Tim Peters b713ec2531 Bug #1334662 / patch #1335972: int(string, base) wrong answers.
In rare cases of strings specifying true values near sys.maxint,
and oddball bases (not decimal or a power of 2), int(string, base)
could deliver insane answers.  This repairs all such problems, and
also speeds string->int significantly.  On my box, here are %
speedups for decimal strings of various lengths:

length speedup
------ -------
 1       12.4%
 2       15.7%
 3       20.6%
 4       28.1%
 5       33.2%
 6       37.5%
 7       41.9%
 8       46.3%
 9       51.2%
10       19.5%
11       19.9%
12       23.9%
13       23.7%
14       23.3%
15       24.9%
16       25.3%
17       28.3%
18       27.9%
19       35.7%

Note that the difference between 9 and 10 is the difference between
short and long Python ints on a 32-bit box.  The patch doesn't
actually do anything to speed conversion to long:  the speedup is
due to detecting "unsigned long" overflow more quickly.

This is a bugfix candidate, but it's a non-trivial patch and it
would be painful to separate the "bug fix" from the "speed up" parts.
2006-05-23 18:45:30 +00:00
Neal Norwitz 5ef922447c Fix #1474677, non-keyword argument following keyword. 2006-05-19 06:43:50 +00:00
Georg Brandl 7b90e168f3 Bug #1462152: file() now checks more thoroughly for invalid mode
strings and removes a possible "U" before passing the mode to the
C library function.
2006-05-18 07:01:27 +00:00
Georg Brandl fad65594ba Fix test_locale for platforms without a default thousands separator. 2006-05-18 06:33:27 +00:00
Georg Brandl b89316fdbf Patch #1180296: improve locale string formatting functions 2006-05-17 15:51:16 +00:00
Tim Peters 1b38357094 Text files missing the SVN eol-style property. 2006-05-16 23:24:08 +00:00
Georg Brandl 8d3342b489 Patch #1435422: zlib's compress and decompress objects now have a
copy() method.
2006-05-16 07:38:27 +00:00
Tim Peters 4ccc0b7dfe test_directory(): Remove the leftover temp directory that's making
the Windows buildbots fail test_tarfile.
2006-05-15 21:32:25 +00:00
Tim Peters 12087bae18 ReadDetectFileobjTest: repair Windows disasters by opening
the file object in binary mode.

The Windows buildbot slaves shouldn't swap themselves to death
anymore.  However, test_tarfile may still fail because of a
temp directory left behind from a previous failing run.
Windows buildbot owners may need to remove that directory
by hand.
2006-05-15 20:44:10 +00:00
Georg Brandl 49c8f4cf36 [ 1488881 ] tarfile.py: support for file-objects and bz2 (cp. #1488634) 2006-05-15 19:30:35 +00:00
Neal Norwitz 373f0a718c - Bug #1487966: Fix SystemError with conditional expression in assignment
Most of the test_syntax changes are just updating the numbers.
2006-05-15 07:04:36 +00:00
Georg Brandl 38c6a22f38 Patch #1484695: Update the tarfile module to version 0.8. This fixes
a couple of issues, notably handling of long file names using the
GNU LONGNAME extension.
2006-05-10 16:26:03 +00:00
Tim Peters ad2ef33245 Variant of patch #1478292. doctest.register_optionflag(name)
shouldn't create a new flag when `name` is already the name of
an option flag.
2006-05-10 02:43:01 +00:00
Georg Brandl b5f2e5cc50 Patch #1479302: Make urllib2 digest auth and basic auth play together. 2006-05-08 17:36:08 +00:00
Georg Brandl a166a91659 Add test for rev. 45934. 2006-05-08 17:28:47 +00:00
Martin v. Löwis d4e3bb3d39 Port access, chmod, parts of getcwdu, mkdir, and utime to direct Win32 API. 2006-05-06 16:32:54 +00:00
Martin v. Löwis 8e0d494e41 Implement os.{chdir,rename,rmdir,remove} using Win32 directly. 2006-05-04 10:08:42 +00:00
Martin v. Löwis 777367103c Patch #1475845: Raise IndentationError for unexpected indent. 2006-05-04 05:51:03 +00:00
Georg Brandl 1bb6230930 Bug #1385040: don't allow "def foo(a=1, b): pass" in the compiler package. 2006-05-03 18:18:32 +00:00
Nick Coghlan afd5e63e24 Finish bringing SVN into line with latest version of PEP 343 by getting rid of all remaining references to context objects that I could find. Without a __context__() method context objects no longer exist. Also get test_with working again, and adopt a suggestion from Neal for decimal.Context.get_manager() 2006-05-03 13:02:47 +00:00
Georg Brandl 1b06a1d4e3 Move network tests from test_urllib2 to test_urllib2net. 2006-05-03 05:15:10 +00:00
Tim Peters 4511a713d5 Whitespace normalization. 2006-05-03 04:46:14 +00:00
Andrew M. Kuchling 214db63df8 Use open() instead of file() 2006-05-02 21:44:33 +00:00
Guido van Rossum b2045837b6 Hopefully this will fix the spurious failures of test_mailbox.py that I'm
experiencing.  (This code and mailbox.py itself are full of calls to file()
that should be calls to open() -- but I'm not fixing those.)
2006-05-02 20:47:36 +00:00
Guido van Rossum da5b701aee Get rid of __context__, per the latest changes to PEP 343 and python-dev
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
2006-05-02 19:47:52 +00:00
Guido van Rossum 8f6cbe1502 Fix the formatting of KeyboardInterrupt -- a bad issubclass() call. 2006-05-02 17:36:09 +00:00
Fred Drake 017e68c413 SF #1479988: add methods to allow access to weakrefs for the
weakref.WeakKeyDictionary and weakref.WeakValueDictionary
2006-05-02 06:53:59 +00:00