Commit Graph

5111 Commits

Author SHA1 Message Date
Tim Peters c377b16d12 Since the most likely failure mode for an expected-output test is a change
somewhere inside a line, use ndiff so that intraline difference marking
can point out what changed within a line.  I don't remember diff-style
abbreviations either (haven't used it since '94, except to produce
patches), so say the rest in English too.
2001-09-22 05:31:03 +00:00
Barry Warsaw bdefa0b3de __iter__(): New method so that StringIO's can participate in the
iterator protocol.
2001-09-22 04:34:54 +00:00
Barry Warsaw 7f8ff471f8 Converted test_StringIO.py to use unittest, so
Lib/test/output/test_StringIO is no longer necessary.

Also, added a test of the iterator protocol that's just been added to
StringIO's and cStringIO's.
2001-09-22 04:33:47 +00:00
Fred Drake 3208d4b387 Start of a test to make sure the profiler/tracer support in the core
interpreter is reporting what we expect to see.
2001-09-22 04:28:19 +00:00
Guido van Rossum 19c1cd5b35 Add the __getattr__ hook back. The rules are now:
- if __getattribute__ exists, it is called first;
  if it doesn't exists, PyObject_GenericGetAttr is called first.
- if the above raises AttributeError, and __getattr__ exists,
  it is called.
2001-09-21 21:24:49 +00:00
Guido van Rossum cf691935bb reportdiff(): print a "plain diff" style diff.
XXX This should really be a unified diff, but I can't be bothered.
2001-09-21 21:06:22 +00:00
Guido van Rossum 0a07639779 Oops. I didn't expect that some tests (test_cookie) have expected
output *and* doctest stuff.  Assuming the doctest stuff comes after the
expected output, this fixes that.
2001-09-21 20:45:44 +00:00
Guido van Rossum 0fcca4e815 Change the way unexpected output is reported: rather than stopping at
the first difference, let the test run till completion, then gather
all the output and compare it to the expected output using difflib.

XXX Still to do: produce diff output that only shows the sections that
differ; currently it produces ndiff-style output because that's the
easiest to produce with difflib, but this becomes a liability when the
output is voluminous and there are only a few differences.
2001-09-21 20:31:52 +00:00
Guido van Rossum 867a8d2e26 Change the name of the __getattr__ special method for new-style
classes to __getattribute__, to make it crystal-clear that it doesn't
have the same semantics as overriding __getattr__ on classic classes.

This is a halfway checkin -- I'll proceed to add a __getattr__ hook
that works the way it works in classic classes.
2001-09-21 19:29:08 +00:00
Guido van Rossum dbb718fa87 Make these modules work when Python is compiled without Unicode support. 2001-09-21 19:22:34 +00:00
Guido van Rossum 11310bf867 Add tests for repr() of strings containing string quotes as well. 2001-09-21 15:46:41 +00:00
Guido van Rossum e4874aeab0 Test basic functioning of unicode repr(). (If this breaks Jython,
please let me know and we'll figure out how to fix the test.)
2001-09-21 15:36:41 +00:00
Guido van Rossum 8b9cc7e69e Add a small test to verify that member and getset descriptors now have
docstrings (using file.closed and file.name as examples).
2001-09-20 21:49:53 +00:00
Guido van Rossum a56b42b1ba Change testdescr.py to use the test_main() approach. 2001-09-20 21:39:07 +00:00
Fred Drake 2e2be3760c Change the PyUnit-based tests to use the test_main() approach. This
allows using the tests with unittest.py as a script.  The tests will
still run when run as a script themselves.
2001-09-20 21:33:42 +00:00
Marc-André Lemburg 3508e30861 Fix Unicode .join() method to raise a TypeError for sequence
elements which are not Unicode objects or strings. (This matches
the string.join() behaviour.)

Fix a memory leak in the .join() method which occurs in case
the Unicode resize fails.

Restore the test_unicode output.
2001-09-20 17:22:58 +00:00
Marc-André Lemburg 5e89bd656f Update test output after the unicode() change. 2001-09-20 16:37:23 +00:00
Marc-André Lemburg 35b0cb09d7 Python part of the UTF-7 codec by Brian Quinlan. 2001-09-20 12:56:14 +00:00
Marc-André Lemburg 6871f6ac57 Implement the changes proposed in patch #413333. unicode(obj) now
works just like str(obj) in that it tries __str__/tp_str on the object
in case it finds that the object is not a string or buffer.
2001-09-20 12:53:16 +00:00
Marc-André Lemburg c60e6f7771 Patch #435971: UTF-7 codec by Brian Quinlan. 2001-09-20 10:35:46 +00:00
Marc-André Lemburg 26e3b681b2 Patch #462635 by Andrew Kuchling correcting bugs in the new
codecs -- the self argument does matter for Python functions (it
does not for C functions which most other codecs use).
2001-09-20 10:33:38 +00:00
Barry Warsaw c88425e2b2 run_suite(): Oops, update a docstring. 2001-09-20 06:31:22 +00:00
Barry Warsaw c10d690744 run_suite(): Factor this out of run_unittest() for tests that build
their own test suite from a multitude of classes (like test_email.py
will be doing).

run_unittest(): Call run_suite() after making a suite from the
testclass.
2001-09-20 06:30:41 +00:00
Tim Peters 4bcfa317ee Since inspect.isfunction(obj) is a precondition for calling
inspect.getargspec(obj), test isfunction() directly in pydoc.py instead
of trying to indirectly deduce isfunction() in pydoc by virtue of
failing a combination of other tests.  This shouldn't have any visible
effect, except perhaps to squash a TypeError death if there was some path
thru this code that was inferring isfunction() by mistake.
2001-09-20 06:08:24 +00:00
Tim Peters f1d90b965e Ensure that isfunction(obj) and (the new) ismethoddescriptor(obj) never
both return true.  This restores pydoc's ability to deduce argument lists
for functions and methods coded in Python.
2001-09-20 05:47:55 +00:00
Tim Peters 536d2262f7 After much thrashing, I believe this is a truly minimal patch to teach
pydoc how to do something sensible with 2.2 descriptors.  To see the
difference, browse __builtin__ via pydoc before and after the patch.
2001-09-20 05:13:38 +00:00
Martin v. Löwis f6cc07cffe Patch #461321: Support None as a timeout in poll2 and poll3. 2001-09-19 17:31:47 +00:00
Guido van Rossum 5b5e0b9bf9 Keep tabnanny happy. 2001-09-19 13:28:25 +00:00
Marc-André Lemburg 816a1b75b7 Fixed search function error reporting in the encodings package
__init__.py module to raise errors which can be catched as LookupErrors
as well as SystemErrors.

Modified the error messages to include more information about the
failing module.
2001-09-19 11:52:07 +00:00
Marc-André Lemburg aa32c5aa7c Added new helpers for easy access to codecs. Docs will follow. 2001-09-19 11:24:48 +00:00
Martin v. Löwis 5485404293 Patch to bug #461754: CDATA should not undergo entity subst. 2001-09-19 09:08:19 +00:00
Guido van Rossum 1952e388ca Add additional coercion support for "self subtypes" to int, long,
float (compare the recent checkin to complex).  Added tests for these.
2001-09-19 01:25:16 +00:00
Guido van Rossum d5d8e4a436 Enable two checks for comparing a complex to a complex subtype
instance.

Split a string comparison test in two halves, replacing "a==b==a" with
separate tests for a==b and b==a.  (Reason: while experimenting, this
test failed, and I wanted to know if it was the first or the second ==
operator that failed.)
2001-09-19 01:16:16 +00:00
Tim Peters 50fda6c21f Enable some comparison tests that failed before. Still having problems
with subsclasses of complex and string.
2001-09-18 21:24:18 +00:00
Guido van Rossum 0639f59859 Add a similar test for rich comparisons. 2001-09-18 21:06:04 +00:00
Fredrik Lundh 59b68656f8 fixed #449964: sre.sub raises an exception if the template contains a
\g<x> group reference followed by a character escape

(also restructured a few things on the way to fixing #449000)
2001-09-18 20:55:24 +00:00
Guido van Rossum ab3b0343b8 Hopefully fix 3-way comparisons. This unfortunately adds yet another
hack, and it's even more disgusting than a PyInstance_Check() call.
If the tp_compare slot is the slot used for overrides in Python,
it's always called.

Add some tests that show what should work too.
2001-09-18 20:38:53 +00:00
Guido van Rossum eb94905265 Get rid of a superfluous space after "--" in the message printed for a
skipped test -- the print command already supplies a space.
2001-09-18 20:34:19 +00:00
Andrew M. Kuchling 97c56357b1 Fix typo in comment 2001-09-18 20:29:48 +00:00
Guido van Rossum 843daa8cad Test for the safety check in wrap_cmpfunc(). 2001-09-18 20:04:26 +00:00
Fredrik Lundh 21009b9c6f an SRE bugfix a day keeps Guido away...
#462270: sub-tle difference between pre.sub and sre.sub.  PRE ignored
an empty match at the previous location, SRE didn't.

also synced with Secret Labs "sreopen" codebase.
2001-09-18 18:47:09 +00:00
Guido van Rossum 912e56c3ac SF bug #417176 (Martijn Pieters): MultiFile.read() includes CRLF
boundary.

Fixed by keeping a readahead buffer containing the next line.

XXX We have no test suite for this.  Maybe the new email package will
help?
2001-09-18 14:34:06 +00:00
Guido van Rossum 555d12f986 softspace(): be prepared to catch AttributeError as well as TypeError
upon attempted attribute assignment.  Caught by MWH, SF bug #462522.
2001-09-18 13:33:01 +00:00
Tim Peters 22cd768177 This module didn't work at all anymore -- blew up with AttributeError
on file.__methods__.  Since the docs say "This module will become obsolete
in a future release", this is just a quick hack to stop it from blowing
up.  If you care about this module, test it!  It doesn't make much sense
on Windows.
2001-09-18 05:40:24 +00:00
Guido van Rossum db2a902dee Undo some (but not all) of the more lenient acceptance of
(AttributeError, TypeError) -- the leniency wasn't needed everywhere.
2001-09-18 03:55:22 +00:00
Guido van Rossum bd13149711 - Some tests that check that assignments are not allowed expect this
to raise TypeError.  In practice, a disallowed attribute assignment
  can raise either TypeError or AttributeError (and it's unclear which
  is better).  So allow either.  (Yes, this is in anticipation of a
  code change that switches the exception raised. :-)

- Add a utility function, cantset(), which verifies that setting a
  particular attribute to a given value is disallowed, and also that
  deleting that same attribute is disallowed.  Use this in the
  test_func_*() tests.

- Add a new set of tests that test conformance of various instance
  method attributes.  (Also in anticipation of code that changes their
  implementation.)
2001-09-18 03:28:54 +00:00
Tim Peters b64bec3ec0 Whitespace normalization. 2001-09-18 02:26:39 +00:00
Tim Peters a86f0c17a1 Make test_socketserver require the network resource.
Add it back to the list of tests we expect to skip on Windows.
2001-09-18 02:18:57 +00:00
Tim Peters 7a76d4b4e4 I don't expect test_socketserver to get skipped on Windows anymore. 2001-09-18 00:24:10 +00:00
Tim Peters a9f6f22f72 Rework akin to test_threaded_import, so that this can run under regrtest.
Also raise TestSkipped (intead of appearing to fail) if the import lock
is held.
2001-09-17 23:56:20 +00:00