Commit Graph

1437 Commits

Author SHA1 Message Date
Guido van Rossum 7b9144b2ee Halfway checkin. This is still messy, but it's beginning to address
the problem that slots weren't inherited properly.  override_slots()
no longer exists; in its place comes fixup_slot_dispatchers() which
does more and different work and is table-based.  (Eventually I want
this table also to replace all the little tab_foo tables.)

Also add a wrapper for __delslice__; this required a change in
test_descrtut.py.
2001-10-09 19:39:46 +00:00
Barry Warsaw fee435af8b Added tests for MIMEAudio class/module 2001-10-09 19:23:57 +00:00
Barry Warsaw 2f6a0b00a0 Add a test for get_all() returning failobj. msg_20.txt is a sample
message with multiple CC: fields, used in the get_all() test.
2001-10-09 15:49:35 +00:00
Guido van Rossum 0eb2a6e974 It turned out not so difficult to support old-style numbers (those
without the Py_TPFLAGS_CHECKTYPES flag) in the wrappers.  This
required a few changes in test_descr.py to cope with the fact that the
complex type has __int__, __long__ and __float__ methods that always
raise an exception.
2001-10-09 11:07:24 +00:00
Fred Drake 168beada91 Added tests that check getboolean() with the newly allowed values from
SF patch #467580.
2001-10-08 17:13:12 +00:00
Guido van Rossum 4570455813 Change all occurrences of verify(x == y) into vereq(x, y), since when
this type of test fails, vereq() does a better job of reporting than
verify().

Change vereq(x, y) to use "not x == y" rather than "x != y" -- it
makes a difference is some overloading tests.
2001-10-08 16:35:45 +00:00
Guido van Rossum 9475a2310d Enable GC for new-style instances. This touches lots of files, since
many types were subclassable but had a xxx_dealloc function that
called PyObject_DEL(self) directly instead of deferring to
self->ob_type->tp_free(self).  It is permissible to set tp_free in the
type object directly to _PyObject_Del, for non-GC types, or to
_PyObject_GC_Del, for GC types.  Still, PyObject_DEL was a tad faster,
so I'm fearing that our pystone rating is going down again.  I'm not
sure if doing something like

void xxx_dealloc(PyObject *self)
{
	if (PyXxxCheckExact(self))
		PyObject_DEL(self);
	else
		self->ob_type->tp_free(self);
}

is any faster than always calling the else branch, so I haven't
attempted that -- however those types whose own dealloc is fancier
(int, float, unicode) do use this pattern.
2001-10-05 20:51:39 +00:00
Fred Drake 4e7cdb57f9 Non-failing test for SF bug #467059. 2001-10-04 20:05:10 +00:00
Fred Drake 266410355f run_suite(): If testclass is not available, provide an even more general
error message.
run_unittest():  Provide the testclass to run_suite() so it can construct
                 the error message.
This closes SF bug #467763.
2001-10-04 19:46:07 +00:00
Barry Warsaw d1de6eacf2 TestIterators: Tim Peters suggests a more succinct spelling of
"listify an iterator".
2001-10-04 18:18:37 +00:00
Barry Warsaw c4496f886b More test data for test_email.py 2001-10-04 17:59:42 +00:00
Barry Warsaw 08a534d476 test_header_splitter(), test_body_line_iterator(): Move the test data
into tests/data/msg_*.txt files.
2001-10-04 17:58:50 +00:00
Fred Drake 7c0a93d966 Updated to reflect the rationalized profiler event reporting. 2001-10-04 14:49:46 +00:00
Tim Peters c59fb2d230 This test relied on hard tab characters, so failed after whitespace
normalization.  Now uses \t in strings instead of hard tabs.
2001-10-04 06:26:17 +00:00
Tim Peters 4fb1fe8bd2 class_docstrings(): The new-style class tests should use new-style
classes (sheesh!).
2001-10-04 05:48:13 +00:00
Tim Peters 527e64fd68 Whitespace normalization. 2001-10-04 05:36:56 +00:00
Tim Peters 2f93e28a19 SF bug [#467331] ClassType.__doc__ always None.
For a dynamically constructed type object, fill in the tp_doc slot with
a copy of the argument dict's "__doc__" value, provided the latter exists
and is a string.
NOTE:  I don't know what to do if it's a Unicode string, so in that case
tp_doc is left NULL (which shows up as Py_None if you do Class.__doc__).
Note that tp_doc holds a char*, not a general PyObject*.
2001-10-04 05:27:00 +00:00
Guido van Rossum f137f75ab8 Hopefully fix the profiler right. Add a test suite that checks that
it deals correctly with some anomalous cases; according to this test
suite I've fixed it right.

The anomalous cases had to do with 'exception' events: these aren't
generated when they would be most helpful, and the profiler has to
work hard to recover the right information.  The problems occur when C
code (such as hasattr(), which is used as the example here) calls back
into Python code and clears an exception raised by that Python code.
Consider this example:

    def foo():
        hasattr(obj, "bar")

Where obj is an instance from a class like this:

    class C:
        def __getattr__(self, name):
            raise AttributeError

The profiler sees the following sequence of events:

    call (foo)
    call (__getattr__)
    exception (in __getattr__)
    return (from foo)

Previously, the profiler would assume the return event returned from
__getattr__. An if statement checking for this condition and raising
an exception was commented out...  This version does the right thing.
2001-10-04 00:58:24 +00:00
Fred Drake 0099ba73de Add some more test cases to be sure we do the right thing in various cases. 2001-10-03 21:15:32 +00:00
Guido van Rossum 4a5a2bc2b6 dynamics(): add a dummy __getattr__ method to the C class so that the
test for modifying __getattr__ works, now that slot_tp_getattr_hook
zaps the slot if there's no hook.  Added an XXX comment with a ref
back to slot_tp_getattr_hook.
2001-10-03 13:59:54 +00:00
Tim Peters 1b0e5490c5 Made the classmethod docstring test a bit less trivial. 2001-10-03 04:15:28 +00:00
Tim Peters 17111f3b24 SF bug [#467336] doctest failures w/ new-style classes.
Taught doctest about static methods, class methods, and property docstrings
in new-style classes.  As for inspect.py/pydoc.py before it, the new stuff
needed didn't really fit into the old architecture (but was less of a
strain to force-fit here).
New-style class docstrings still aren't found, but that's the subject
of a different bug and I want to fix that right instead of hacking around
it in doctest.
2001-10-03 04:08:26 +00:00
Guido van Rossum 048eb75c2d Add Garbage Collection support to new-style classes (not yet to their
instances).

Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy.  (Only type objects have a tp_clear
field; the other types are.)

One change was necessary to the GC infrastructure.  We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header.  Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests...  In short, a mess.  So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not.  This slot is
only relevant for types that have the (new) GC flag bit set.  If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers.  This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).

I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs.  (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
Guido van Rossum fe1fd0e6e9 pickles():
- The test for deepcopy() in pickles() was indented wrongly, so it got
  run twice (one for binary pickle mode, one for text pickle mode; but
  the test doesn't depend on the pickle mode).

- In verbose mode, show which subtest (pickle/cPickle/deepcopy, text/bin).
2001-10-02 19:58:32 +00:00
Guido van Rossum c907bd89de The error reporting here was a bit sparse. In verbose mode, the code
in run_test() referenced two non-existent variables, and in
non-verbose mode, the tests didn't report the actual number, when it
differed from the expected number.  Fixed this.

Also added an extra call to gc.collect() at the start of test_all().
This will be needed when I check in the changes to add GC to new-style
classes.
2001-10-02 19:49:47 +00:00
Tim Peters 7402f791a4 SF patch [#466616] Exclude imported items from doctest,
from Tim Hochberg.  Also mucho fiddling to change the way doctest
determines whether a thing is a function, module or class.  Under 2.2,
this really requires the functions in inspect.py (e.g., types.ClassType
is close to meaningless now, if not outright misleading).
2001-10-02 03:53:41 +00:00
Skip Montanaro 419abdaff2 simple dumps/loads test case for xmlrpclib 2001-10-01 17:47:44 +00:00
Martin v. Löwis 16dc7f44b1 Patch #462190, patch #464070: Support quoted printable in the binascii module.
Decode and encode underscores for header style encoding. Fixes bug #463996.
2001-09-30 20:32:11 +00:00
Guido van Rossum 751c4c864c Add a few ``__dynamic__ = 0'' lines in classes that need to preserve
staticness when __dynamic__ = 1 becomes the default:

- Some classes which are used to test the difference between static
  and dynamic.

- Subclasses of complex: complex uses old-style numbers and the slot
  wrappers used by dynamic classes only support new-style numbers.
  (Ideally, the complex type should be fixed, but that looks like a
  labor-intensive job.)
2001-09-29 00:40:25 +00:00
Guido van Rossum 4bb1e36eec It's a fact: for binary operators, *under certain circumstances*,
__rop__ now takes precendence over __op__.  Those circumstances are:

  - Both arguments are new-style classes
  - Both arguments are new-style numbers
  - Their implementation slots for tp_op differ
  - Their types differ
  - The right argument's type is a subtype of the left argument's type

Also did this for the ternary operator (pow) -- only the binary case
is dealt with properly though, since __rpow__ is not supported anyway.
2001-09-28 23:49:48 +00:00
Fred Drake 946f7b1b24 Update the xml.dom.minidom tests to cover the DOM-compliant parts of the
NodeList interface.
2001-09-28 20:31:50 +00:00
Fred Drake 88a56857f6 Remove an infelicitous space. 2001-09-28 20:16:30 +00:00
Tim Peters 9390cc15da regrtest's -g option stopped working, during the changes to improve
error-reporting for the classic compare-expected-output tests.
Curiously, the bug consisted of not simplifying the logic enough!
2001-09-28 20:14:46 +00:00
Fred Drake b2ad1c8b4d Reflect recent refinements of the regression testing framework. 2001-09-28 20:05:25 +00:00
Guido van Rossum 6cef6d5d62 Changes to copy() and deepcopy() in copy.py to support __reduce__ as a
fallback for objects that are neither supported by our dispatch table
nor have a __copy__ or __deepcopy__ method.

Changes to _reduce() in copy_reg.py to support reducing objects that
don't have a __dict__ -- copy.copy(complex()) now invokes _reduce().

Add tests for copy.copy() and copy.deepcopy() to test_regrtest.py.
2001-09-28 18:13:29 +00:00
Fred Drake 39cd603fc8 More test cases, including something that simulates what the profiler
probably *should* be doing.
2001-09-26 21:00:33 +00:00
Tim Peters 38a50f9065 A file just to look at (using pydoc). 2001-09-26 20:31:52 +00:00
Jeremy Hylton ede049b2d3 Add tests for new PyErr_NormalizeException() behavior
Add raise_exception() to the _testcapi module.  It isn't a test, but
the C API exists only to support test_exceptions.  raise_exception()
takes two arguments -- an exception class and an integer specifying
how many arguments it should be called with.

test_exceptions uses BadException() to test the interpreter's behavior
when there is a problem instantiating the exception.  test_capi1()
calls it with too many arguments.  test_capi2() causes an exception to
be raised in the Python code of the constructor.
2001-09-26 20:01:13 +00:00
Thomas Wouters 80d373cbd0 Test case for SF bugs #463359 and #462937, added to test_grammar for lack of
a better place. Excessively fragile code, but at least it breaks when
something in this area changes!
2001-09-26 12:43:39 +00:00
Barry Warsaw 65279d0242 Update the tests for the current incarnation of the email package, and
added some new tests of message/delivery-status content type messages.
2001-09-26 05:47:08 +00:00
Barry Warsaw 0e416cd88e More test messages for test_email.py 2001-09-26 05:45:17 +00:00
Barry Warsaw 45653503ec test_iterator(): Don't do a type comparison to see if it's an
iterator, just test to make sure it has the two required iterator
protocol methods __iter__() and next() -- actually just test
hasattr-ness.
2001-09-25 21:40:04 +00:00
Fred Drake cc91ac09ef Factor out the protect-from-exceptions helpers and make capture_events()
use it.  This simplifies the individual tests a little.

Added some new tests related to exception handling.
2001-09-25 20:48:14 +00:00
Tim Peters 8dee809410 Guido points out that sys.__stdout__ is a bit bucket under IDLE. So keep
the local save/modify/restore of sys.stdout, but add machinery so that
regrtest can tell test_support the value of sys.stdout at the time
regrtest.main() started, and test_support can pass that out later to anyone
who needs a "visible" stdout.
2001-09-25 20:05:11 +00:00
Tim Peters d48004f4f0 test_support should be imported directly, not via test.test_support. 2001-09-25 19:29:35 +00:00
Tim Peters 342ca75d95 Get rid of the increasingly convoluted global tricks w/ sys.stdout, in
favor of local save/modify/restore.  The test suite should run fine again.
2001-09-25 19:13:20 +00:00
Guido van Rossum 3926a63d05 - Provisional support for pickling new-style objects. (*)
- Made cls.__module__ writable.

- Ensure that obj.__dict__ is returned as {}, not None, even upon first
  reference; it simply springs into life when you ask for it.

(*) The pickling support is provisional for the following reasons:

- It doesn't support classes with __slots__.

- It relies on additional support in copy_reg.py: the C method
  __reduce__, defined in the object class, really calls calling
  copy_reg._reduce(obj).  Eventually the Python code in copy_reg.py
  needs to be migrated to C, but I'd like to experiment with the
  Python implementation first.  The _reduce() code also relies on an
  additional helper function, _reconstructor(), defined in
  copy_reg.py; this should also be reimplemented in C.
2001-09-25 16:25:58 +00:00
Guido van Rossum ad39aba2f6 Set sys.save_stdout (to sys.stdout), so doctest-using tests can be run
standalone.
2001-09-25 16:21:39 +00:00
Guido van Rossum a4cb78874c Change repr() of a new-style class to say <class 'ClassName'> rather
than <type 'ClassName'>.  Exception: if it's a built-in type or an
extension type, continue to call it <type 'ClassName>.  Call me a
wimp, but I don't want to break more user code than necessary.
2001-09-25 03:56:29 +00:00
Guido van Rossum 5c294fb0e6 Make __class__ assignment possible, when the object structures are the
same.  I hope the test for structural equivalence is stringent enough.
It only allows the assignment if the old and new types:

- have the same basic size
- have the same item size
- have the same dict offset
- have the same weaklist offset
- have the same GC flag bit
- have a common base that is the same except for maybe the dict and
  weaklist (which may have been added separately at the same offsets
  in both types)
2001-09-25 03:43:42 +00:00
Tim Peters 66c1a525e0 Make properties discoverable from Python:
- property() now takes 4 keyword arguments:  fget, fset, fdel, doc.
  Note that the real purpose of the 'f' prefix is to make fdel fit in
  ('del' is a keyword, so can't used as a keyword argument name).

- These map to visible readonly attributes 'fget', 'fset', 'fdel',
  and '__doc__' in the property object.

- fget/fset/fdel weren't discoverable from Python before.

- __doc__ is new, and allows to associate a docstring with a property.
2001-09-24 21:17:50 +00:00
Fred Drake 30c4849169 Added several new tests to check the behavior with respect to doctype
declarations and weird markup that we used to accept & ignore that recent
versions raised an exception for; the original behavior has been restored
and augmented (the user can decide what to do if they care; the default is
to ignore it as done in early versions).
2001-09-24 20:22:09 +00:00
Fred Drake e822049efc Adapt to use the test_main() approach. 2001-09-24 20:19:08 +00:00
Guido van Rossum 3d45d8f12e Another comparison patch-up: comparing a type with a dynamic metatype
to one with a static metatype raised an obscure error.
2001-09-24 18:47:40 +00:00
Fred Drake 2d879017b3 Add more tests showing the relationship between exceptions raised & caught
and the information provided to the profiler.  This stuff is a mess!
2001-09-24 18:44:11 +00:00
Guido van Rossum 2205642fe0 Do the same thing to complex that I did to str: the rich comparison
function returns NotImplemented when comparing objects whose
tp_richcompare slot is not itself.
2001-09-24 17:52:04 +00:00
Marc-André Lemburg e47df7a211 StringIO patch #462596: let's [c]StringIO accept read buffers on
input to .write() too.
2001-09-24 17:34:52 +00:00
Guido van Rossum bb77e6801e Change string comparison so that it applies even when one (or both)
arguments are subclasses of str, as long as they don't override rich
comparison.
2001-09-24 16:51:54 +00:00
Guido van Rossum ff0e6d6ef5 Fix the baffler that Tim reported: sometimes the repr() of an object
looks like <X object at ...>, sometimes it says <X instance at ...>.
Make this uniformly say <X object at ...>.
2001-09-24 16:03:59 +00:00
Tim Peters 2c9aa5ea8d Generalize file.writelines() to allow iterable objects. 2001-09-23 04:06:05 +00:00
Barry Warsaw d31db7e939 The test data (mostly example messages) for the email package test
suite.  Note that other tests can put input data in this directory.
2001-09-23 03:19:33 +00:00
Barry Warsaw 4107585a67 An extensive test suite for the email package. 2001-09-23 03:18:13 +00:00
Tim Peters 13b49d3374 New function classify_class_attrs(). As a number of SF bug reports
point out, pydoc doesn't tell you where class attributes were defined,
gets several new 2.2 features wrong, and isn't aware of some new features
checked in on Thursday <wink>.  pydoc is hampered in part because
inspect.py has the same limitations.  Alas, I can't think of a way to
fix this within the current architecture of inspect/pydoc:  it's simply
not possible in 2.2 to figure out everything needed just from examining
the object you get back from class.attr.  You also need the class
context, and the method resolution order, and tests against various things
that simply didn't exist before.  OTOH, knowledge of how to do that is
getting quite complex, so doesn't belong in pydoc.

classify_class_attrs takes a different approach, analyzing all
the class attrs "at once", and returning the most interesting stuff for
each, all in one gulp.  pydoc needs to be reworked to use this for
classes (instead of the current "filter dir(class) umpteen times against
assorted predicates" approach).
2001-09-23 02:00:29 +00:00
Tim Peters e0b2d7ac9a Add a function to compute a class's method resolution order. This is
easy for 2.2 new-style classes, but trickier for classic classes, and
different approaches are needed "depending".  The function will allow
later code to treat all flavors of classes uniformly.
2001-09-22 06:10:55 +00:00
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 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 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
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
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
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 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
Guido van Rossum d9d1d4ac6f Rewrite function attributes to use the generic routines properly.
This uses the new "restricted" feature of structmember, and getset
descriptors for some of the type checks.
2001-09-17 23:46:56 +00:00