Guido van Rossum [Thu, 29 Aug 2002 15:10:30 +0000 (15:10 +0000)]
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.
Barry Warsaw [Thu, 29 Aug 2002 13:09:47 +0000 (13:09 +0000)]
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.
Jack Jansen [Wed, 28 Aug 2002 22:22:10 +0000 (22:22 +0000)]
Distutils-based script by Bill Fancher to download the Python documentation
HTML tarball and use it to create a documentation tree readable and
searchable with Apple Help Viewer. The documentation also shows up in
Project Builder (if you add Python.framework to your project).
Jack Jansen [Wed, 28 Aug 2002 21:27:02 +0000 (21:27 +0000)]
- Install a symlink to the documentation (which lives in the framework)
in Python.app, and refer to it in Info.plist. This makes Apple Help
Viewer recognize the Python documentation.
- Changed the externally visible name of Python.app to "Python" (was PythonW).
Jack Jansen [Wed, 28 Aug 2002 21:23:53 +0000 (21:23 +0000)]
Distutils-based script by Bill Fancher to download the Python documentation
HTML tarball and use it to create a documentation tree readable and
searchable with Apple Help Viewer. The documentation also shows up in
Project Builder (if you add Python.framework to your project).
Tim Peters [Sun, 25 Aug 2002 18:43:10 +0000 (18:43 +0000)]
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.
Kurt B. Kaiser [Sun, 25 Aug 2002 14:08:07 +0000 (14:08 +0000)]
1. Revert subprocess environment clearing, will restart subprocess
instead.
2. Preserve the Idle client's listening socket for reuse with the
fresh subprocess.
3. Remove some unused rpc code, comment out additional unused code.
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).
Guido van Rossum [Sat, 24 Aug 2002 06:57:49 +0000 (06:57 +0000)]
string_contains(): speed up by avoiding function calls where
possible. This always called PyUnicode_Check() and PyString_Check(),
at least one of which would call PyType_IsSubtype(). Also, this would
call PyString_Size() on known string objects.
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.
Since instances of _TemporarilyImmutableSet are always thrown away
immediately after the comparison, there in no use in caching the hashcode.
The test, 'if self._hashcode is None', never fails. Removing the caching
saves a few lines and a little time.
1. Removed module self test in favor of unittests -- Timbot's suggestion.
2. Replaced calls to Set([]) with Set() -- Timbot's suggestion
3. Fixed subtle bug in sets of sets:
The following code did not work (will add to test suite):
d = Set('d')
s = Set([d]) # Stores inner set as an ImmutableSet
s.remove(d) # For comparison, wraps d in _TemporarilyImmutableSet
The comparison proceeds by computing the hash of the
_TemporarilyImmutableSet and finding it in the dictionary.
It then verifies equality by calling ImmutableSet.__eq__()
and crashes from the binary sanity check.
The problem is that the code assumed equality would be checked
with _TemporarilyImmutableSet.__eq__().
The solution is to let _TemporarilyImmutableSet derive from BaseSet
so it will pass the sanity check and then to provide it with the
._data element from the wrapped set so that ImmutableSet.__eq__()
will find ._data where it expects.
Since ._data is now provided and because BaseSet is the base class,
_TemporarilyImmutableSet no longer needs .__eq__() or .__ne__().
Note that inheriting all of BaseSet's methods is harmless because
none of those methods (except ones starting with an underscore)
can mutate the .data element. Also _TemporarilyImmutableSet is only
used internally as is not otherwise visible.
Guido van Rossum [Fri, 23 Aug 2002 18:50:21 +0000 (18:50 +0000)]
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.
Guido van Rossum [Fri, 23 Aug 2002 18:21:28 +0000 (18:21 +0000)]
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.
Guido van Rossum [Fri, 23 Aug 2002 14:11:35 +0000 (14:11 +0000)]
The error messages in err_args() -- which is only called when the
required number of args is 0 or 1 -- were reversed. Also change "1"
into "exactly one", the same words as used elsewhere for this
condition.
Guido van Rossum [Fri, 23 Aug 2002 01:36:01 +0000 (01:36 +0000)]
Rewritten using the tokenize module, which gives us a real tokenizer
rather than a number of approximating regular expressions.
Alas, it is 3-4 times slower. Let that be a challenge for the
tokenize module.
Greg Ward [Thu, 22 Aug 2002 21:04:21 +0000 (21:04 +0000)]
Fix SF bug #596434: tweak wordsep_re so "--foo-bar" now splits
into /--foo-/bar/ rather than /--/foo-/bar/. Needed for Optik and
Docutils to handle Unix-style command-line options properly.
Guido van Rossum [Thu, 22 Aug 2002 20:02:03 +0000 (20:02 +0000)]
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.
Greg Ward [Thu, 22 Aug 2002 19:47:27 +0000 (19:47 +0000)]
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.)
Greg Ward [Thu, 22 Aug 2002 19:02:37 +0000 (19:02 +0000)]
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().
Greg Ward [Thu, 22 Aug 2002 18:55:38 +0000 (18:55 +0000)]
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.
Greg Ward [Thu, 22 Aug 2002 18:45:02 +0000 (18:45 +0000)]
Simplify and reformat the use of 'subcases' lists (and following
for-loops) in test_simple(), test_wrap_short() test_hyphenated(), and
test_funky_punc().
Greg Ward [Thu, 22 Aug 2002 18:35:49 +0000 (18:35 +0000)]
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.
Greg Ward [Thu, 22 Aug 2002 18:11:10 +0000 (18:11 +0000)]
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.