Commit Graph

8092 Commits

Author SHA1 Message Date
Gustavo Niemeyer
c34f2555bd Applied patch #725106, by Greg Chapman, fixing capturing groups
within repeats of alternatives. The only change to the original
patch was to convert the tests to the new test_re.py file.

This patch fixes cases like:

>>> re.match('((a)|b)*', 'abc').groups()
('b', '')

Which is wrong (it's impossible to match the empty string),
and incompatible with other regex systems, like the following
examples show:

% perl -e '"abc" =~ /^((a)|b)*/; print "$1 $2\n";'
b a

% echo "abc" | sed -r -e "s/^((a)|b)*/\1 \2|/"
b a|c
2003-04-27 12:34:14 +00:00
Raymond Hettinger
9dcbbea878 Factor out common boilerplate for test_support 2003-04-27 07:54:23 +00:00
Tim Peters
579bed7300 Rewrote. As reported on c.l.py, when the test suite is run via
"import test.autotest", temp_imp failed because the import lock was
still held at the test's end (the test assumed it wouldn't be), and
then a RuntimeError got raised at the end of the entire suite run because
test_imp cleared the import lock as a side effect of trying to test that
the import lock wasn't held (but a legitimate import is in progress,
so the lock should be held, and the import machinery complained when it
found that the lock was unexpectedly cleareed).

Also removed the unittest scaffolding.  It didn't buy anything here, and
the test was raising regrtest's TestFailed instead of using the unittest
failure-reporting mechanisms.
2003-04-26 14:31:24 +00:00
Guido van Rossum
ecf0f02518 Merge back from r23b1-branch 2003-04-26 00:21:31 +00:00
Guido van Rossum
c2f77dddf3 New feature: when saving a file, keep the eol convention of the
original.  New files are written using the eol convention of the
platform, given by os.linesep.  All files are read and written in
binary mode.
2003-04-25 18:36:31 +00:00
Kurt B. Kaiser
9a90e70b32 Update for release into Python
NEWS.txt idlever.py
2003-04-25 17:48:08 +00:00
Kurt B. Kaiser
40f19e3fd5 Update for 2.3b1
Modified Files:
	NEWS.txt CREDITS.txt INSTALL.txt setup.cfg
2003-04-25 16:37:31 +00:00
Skip Montanaro
5ba0054e69 final bit of tests converted from test_sre 2003-04-25 16:00:14 +00:00
Skip Montanaro
9593792da3 test_sre is dead! long live test_re! 2003-04-25 15:59:12 +00:00
Skip Montanaro
35b9ff3683 deleted more tests which were either already in test_re or that I migrated
in the last revison
2003-04-25 15:41:19 +00:00
Skip Montanaro
1e703c6278 more tests converted from test_sre 2003-04-25 15:40:28 +00:00
Skip Montanaro
bf7ad96d36 Remove tests which were migrated to test_re.py. There are still more tests
to migrate.
2003-04-25 15:17:03 +00:00
Guido van Rossum
f4001eed3b Skip testing inet_ntop() an inet_pton() if they aren't defined.
This makes the test pass on Windows again (and on other platforms
that don't have these).
2003-04-25 15:11:23 +00:00
Guido van Rossum
51735b0569 Fix the tests on Windows, by writing the test data file in binary
mode.

XXX I'm not convinced that this is the right solution -- arguably,
on Windows, the _fileobject class should honor the mode argument
and do newline translation.  But it's never done that so I think
there's no urgent need to fix this today.
2003-04-25 15:01:05 +00:00
Skip Montanaro
1448d4719c rework Sniffer api significantly 2003-04-25 14:47:16 +00:00
Skip Montanaro
48816c6f04 some sniffer tests 2003-04-25 14:43:14 +00:00
Skip Montanaro
2726fcd4b6 more tests from test_sre 2003-04-25 14:31:54 +00:00
Fred Drake
7c852f33a2 Attempt to deal with some obvious errors in the code. These were all
due to using a single module-level namespace where multiple namespaces
were used before.

There *really* need to be tests for the sniffer stuff.  This could
have been avoided.

Skip, please review, and add sniffer tests!
2003-04-25 14:27:00 +00:00
Guido van Rossum
376e636f18 New version from Vinaj, should solve the threading problems (hopefully). 2003-04-25 14:22:00 +00:00
Skip Montanaro
7d9963fea8 copy a few tests from test_sre 2003-04-25 14:12:40 +00:00
Walter Dörwald
dbcede5d66 Port test_bool.py to PyUnit. From SF patch #662807. 2003-04-25 10:22:01 +00:00
Brett Cannon
74bfd70e92 Complete rewrite of module. Only has tests using temporary files; net tests
should go in test_urllibnet.py .

Still need to write tests for _urlopener usage and urlretrieve.
2003-04-25 09:39:47 +00:00
Tim Peters
c4e0940042 New generator os.walk() does a bit more than os.path.walk() does, and
seems much easier to use.  Code, docs, NEWS, and additions to test_os.py
(testing this sucker is a bitch!).
2003-04-25 07:11:48 +00:00
Guido van Rossum
47dfa4a89a Patch by Jp Calderone:
- The socket module now provides the functions inet_pton and inet_ntop
  for converting between string and packed representation of IP addresses.
  See SF patch #658327.

This still needs a bit of work in the doc area, because it is not
available on all platforms (especially not on Windows).
2003-04-25 05:48:32 +00:00
Guido van Rossum
45f4130029 test_re is no longer needed 2003-04-25 01:44:40 +00:00
Guido van Rossum
46144be02c Fix test_limitations(). The match there is *expected* to raise
RuntimeError.
2003-04-25 01:40:11 +00:00
Andrew M. Kuchling
0b85203954 [Patch #628208] Test the 'nil' extension 2003-04-25 00:27:24 +00:00
Andrew M. Kuchling
a4c2b7485b [Patch #628208] Add optional support for the 'nil' extension 2003-04-25 00:26:51 +00:00
Skip Montanaro
da4ec5a7bc csv is a module again 2003-04-24 20:23:12 +00:00
Skip Montanaro
04ae7056cf cvs is going to be a module again 2003-04-24 20:21:31 +00:00
Raymond Hettinger
b34ef94d46 SF bug 557704: netrc module can't handle all passwords
Let netrc handle entries with login fields (mail servers for instance)
by having login default to ''.

Backport candidate.
2003-04-24 20:11:20 +00:00
Skip Montanaro
bfcbfa7c46 move imports in Binary class to top level to avoid repeated imports.
use cStringIO if available.
2003-04-24 19:51:31 +00:00
Skip Montanaro
fa012610c4 new method: has_function() - returns a boolean indicating whether the
argument function is available on the current platform
2003-04-24 19:49:23 +00:00
Skip Montanaro
8ed06da754 first cut at unittest version of re tests 2003-04-24 19:43:18 +00:00
Skip Montanaro
d839ecdc81 if the test is run directly (__name__ == "__main__") don't actually require
particular resources
2003-04-24 19:06:57 +00:00
Skip Montanaro
142da98beb remove test_socketserver from the skip lists 2003-04-24 19:05:41 +00:00
Barry Warsaw
c4acc2bd32 GNUTranslations:
__init__(): Removed since we no longer need the coerce flag.
    Message ids and strings are now always coerced to Unicode, /if/
    the catalog specified a charset parameter.

    gettext(), ngettext(): Since the message strings are Unicodes in
    the catalog, coerce back to encoded 8-bit strings on return.

    ugettext(), ungettext(): Coerce the message ids to Unicode when
    there's no entry for the id in the catalog.

Minor code cleanups; use booleans where appropriate.
2003-04-24 18:13:39 +00:00
Barry Warsaw
edb155fda1 UnicodeTranslationsTest.setUp(): Removed the coerce flag to the
GNUTranslations constructor.
2003-04-24 18:08:13 +00:00
Raymond Hettinger
9928571f3f SF bug 665835: filter() treatment of str and tuple inconsistent
As a side issue on this bug, it was noted that list and tuple iterators
used macros to directly access containers and would not recognize
__getitem__ overrides.  If the method is overridden, the patch returns
a generic sequence iterator which calls the __getitem__ method; otherwise,
it returns a high custom iterator with direct access to container elements.
2003-04-24 16:52:47 +00:00
Andrew M. Kuchling
47c2ab6b54 Fix docstring typo 2003-04-24 16:36:49 +00:00
Thomas Heller
54aa5781d5 This test now uses the separate getargs_X functions from _testcapimodule. 2003-04-24 16:15:29 +00:00
Tim Peters
0eadaac7dc Whitespace normalization. 2003-04-24 16:02:54 +00:00
Barry Warsaw
0822ff7cca Get rid of some hard coded tabs 2003-04-24 15:58:47 +00:00
Raymond Hettinger
352f9477da SF patch 695710: fix bug 678519: cStringIO self iterator
(requested by GvR. patch contributed by Michael Stone)
2003-04-24 15:50:11 +00:00
Raymond Hettinger
024aaa1bfe SF Patch 549151: urllib2 POSTs on redirect
(contributed by John J Lee)
2003-04-24 15:32:12 +00:00
Andrew M. Kuchling
9f4eb6b719 [Patch #679505] Silence DeprecationWarning when testing rotor module 2003-04-24 13:18:25 +00:00
Marc-André Lemburg
366a0feb9a Reformatted a bit to remove the lengthy re.compile() from the function
definitions.
2003-04-24 11:46:35 +00:00
Marc-André Lemburg
246d847475 New module platform.py, submitted by Marc-Andre Lemburg.
There's no separate documentation for this module yet - apart from the
doc-strings which explain the APIs.
2003-04-24 11:36:11 +00:00
Raymond Hettinger
f4cf76dd5e Revert the previous enhancement to the bytecode optimizer.
The additional code complexity and new NOP opcode were not worth it.
2003-04-24 05:45:23 +00:00
Brett Cannon
7d618c731c Fix docstring for URLOpener.retrieve() in regards to opening a local file 2003-04-24 02:43:20 +00:00